[REEF-1095] Pass through O.A.R.Tang to hide unnecessarily public APIs JIRA: [REEF-1095](https://issues.apache.org/jira/browse/REEF-1095)
This closes #783 Project: http://git-wip-us.apache.org/repos/asf/reef/repo Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/96279b04 Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/96279b04 Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/96279b04 Branch: refs/heads/master Commit: 96279b048dc9efe1bde590caec7d769d5681bf00 Parents: da0936e Author: Andrew Chung <[email protected]> Authored: Wed Jan 20 16:53:45 2016 -0800 Committer: Julia Wang <[email protected]> Committed: Fri Jan 22 14:31:19 2016 -0800 ---------------------------------------------------------------------- .../Annotations/DefaultImplementation.cs | 2 +- .../Org.Apache.REEF.Tang/Annotations/Inject.cs | 6 +- .../Annotations/NamedParameter.cs | 6 +- .../Annotations/Parameter.cs | 4 +- .../cs/Org.Apache.REEF.Tang/Annotations/Unit.cs | 2 +- .../Exceptions/BindException.cs | 5 +- .../Exceptions/ClassHierarchyException.cs | 6 +- .../Exceptions/IllegalStateException.cs | 3 +- .../Exceptions/InjectionException.cs | 6 +- .../Exceptions/NameResolutionException.cs | 7 +- .../Exceptions/ParseException.cs | 7 +- .../AvroConfiguration.cs | 10 +- .../Formats/ConfigurationFile.cs | 2 +- .../Formats/ConfigurationModuleBuilder.cs | 74 ++++++------ .../ClassHierarchy/AbstractNode.cs | 4 +- .../AvroClassHierarchySerializer.cs | 2 +- .../ClassHierarchy/ClassHierarchyImpl.cs | 2 +- .../ClassHierarchy/ClassNodeImpl.cs | 2 +- .../ClassHierarchy/ConstructorArgImpl.cs | 3 +- .../ClassHierarchy/ConstructorDefImpl.cs | 3 +- .../ClassHierarchy/NamedParameterNodeImpl.cs | 4 +- .../ClassHierarchy/NodeFactory.cs | 2 +- .../ClassHierarchy/PackageNodeImpl.cs | 2 +- .../ClassHierarchy/ParameterParser.cs | 2 +- .../Configuration/ConfigurationBuilderImpl.cs | 2 +- .../Configuration/ConfigurationImpl.cs | 3 +- .../Configuration/Configurations.cs | 2 +- .../Configuration/CsConfigurationBuilderImpl.cs | 2 +- .../Configuration/CsConfigurationImpl.cs | 2 +- .../InjectionPlan/Constructor.cs | 2 +- .../Implementations/InjectionPlan/CsInstance.cs | 2 +- .../InjectionPlan/InjectionFuture.cs | 6 +- .../InjectionPlan/InjectionFuturePlan.cs | 5 +- .../InjectionPlan/InjectionPlan.cs | 4 +- .../InjectionPlan/InjectorImpl.cs | 2 +- .../InjectionPlan/ListInjectionPlan.cs | 2 +- .../InjectionPlan/SetInjectionPlan.cs | 2 +- .../Implementations/InjectionPlan/Subplan.cs | 2 +- .../Implementations/Tang/TangFactory.cs | 2 +- .../Implementations/Tang/TangImpl.cs | 2 +- .../Protobuf/ProtocolBufferClassHierarchy.cs | 114 +++++++++---------- .../Protobuf/ProtocolBufferInjectionPlan.cs | 82 ++++++------- .../Util/AbstractMonotonicMultiMap.cs | 2 +- .../Org.Apache.REEF.Tang/Util/AssemblyLoader.cs | 2 +- .../cs/Org.Apache.REEF.Tang/Util/GenericType.cs | 2 +- .../Util/MonotonicHashMap.cs | 2 +- .../Util/MonotonicHashSet.cs | 10 +- .../Util/MonotonicMultiHashMap.cs | 2 +- .../Util/MonotonicMultiMap.cs | 2 +- .../Org.Apache.REEF.Tang/Util/MonotonicSet.cs | 2 +- .../Util/MonotonicTreeMap.cs | 4 +- .../Util/ReflectionUtilities.cs | 26 ++--- .../Org.Apache.REEF.Tang/Util/SetValuedKey.cs | 3 +- 53 files changed, 224 insertions(+), 237 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Annotations/DefaultImplementation.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Annotations/DefaultImplementation.cs b/lang/cs/Org.Apache.REEF.Tang/Annotations/DefaultImplementation.cs index cbd5f02..e990138 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Annotations/DefaultImplementation.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Annotations/DefaultImplementation.cs @@ -23,7 +23,7 @@ namespace Org.Apache.REEF.Tang.Annotations /// DefaultImplementationAttribute /// </summary> [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, Inherited = false)] - public class DefaultImplementationAttribute : System.Attribute + public sealed class DefaultImplementationAttribute : Attribute { public Type Value { get; set; } public string Name { get; set; } http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Annotations/Inject.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Annotations/Inject.cs b/lang/cs/Org.Apache.REEF.Tang/Annotations/Inject.cs index 5e7af53..1cc1935 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Annotations/Inject.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Annotations/Inject.cs @@ -15,13 +15,15 @@ // specific language governing permissions and limitations // under the License. +using System; + namespace Org.Apache.REEF.Tang.Annotations { /// <summary> /// InjectAttribute /// </summary> - [System.AttributeUsage(System.AttributeTargets.Constructor)] - public class InjectAttribute : System.Attribute + [AttributeUsage(AttributeTargets.Constructor)] + public sealed class InjectAttribute : Attribute { } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Annotations/NamedParameter.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Annotations/NamedParameter.cs b/lang/cs/Org.Apache.REEF.Tang/Annotations/NamedParameter.cs index b005946..3c7fcc0 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Annotations/NamedParameter.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Annotations/NamedParameter.cs @@ -16,14 +16,12 @@ // under the License. using System; -using Org.Apache.REEF.Tang.Formats; -using Org.Apache.REEF.Tang.Types; using Org.Apache.REEF.Tang.Util; namespace Org.Apache.REEF.Tang.Annotations { - [System.AttributeUsage(System.AttributeTargets.Class)] - public class NamedParameterAttribute : System.Attribute + [AttributeUsage(AttributeTargets.Class)] + public sealed class NamedParameterAttribute : Attribute { public const string ReefUninitializedValue = "__REEF_UNINITIALIZED_VALUE__"; http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Annotations/Parameter.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Annotations/Parameter.cs b/lang/cs/Org.Apache.REEF.Tang/Annotations/Parameter.cs index 6f3deeb..d5ea663 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Annotations/Parameter.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Annotations/Parameter.cs @@ -22,8 +22,8 @@ namespace Org.Apache.REEF.Tang.Annotations /// <summary> /// ParameterAttribute /// </summary> - [System.AttributeUsage(System.AttributeTargets.Parameter)] - public class ParameterAttribute : System.Attribute + [AttributeUsage(AttributeTargets.Parameter)] + public sealed class ParameterAttribute : Attribute { public ParameterAttribute() { http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Annotations/Unit.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Annotations/Unit.cs b/lang/cs/Org.Apache.REEF.Tang/Annotations/Unit.cs index c42b9a4..8b3fd5a 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Annotations/Unit.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Annotations/Unit.cs @@ -23,7 +23,7 @@ namespace Org.Apache.REEF.Tang.Annotations /// UnitAttribute /// </summary> [AttributeUsage(AttributeTargets.Class, Inherited = false)] - public class UnitAttribute : System.Attribute + public sealed class UnitAttribute : Attribute { } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs b/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs index e89d013..ee4135f 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs @@ -21,13 +21,12 @@ namespace Org.Apache.REEF.Tang.Exceptions { public class BindException : SystemException { - // private static readonly long serialVersionUID = 1L; - public BindException(string message) + internal BindException(string message) : base(message) { } - public BindException(string message, Exception innerException) + internal BindException(string message, Exception innerException) : base(message, innerException) { } http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs b/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs index 56c2fa0..b6ceb5e 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs @@ -19,13 +19,13 @@ using System; namespace Org.Apache.REEF.Tang.Exceptions { - public class ClassHierarchyException : SystemException + public sealed class ClassHierarchyException : SystemException { - public ClassHierarchyException(string msg) : base(msg) + internal ClassHierarchyException(string msg) : base(msg) { } - public ClassHierarchyException(string message, Exception innerException) + internal ClassHierarchyException(string message, Exception innerException) : base(message, innerException) { } http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Exceptions/IllegalStateException.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Exceptions/IllegalStateException.cs b/lang/cs/Org.Apache.REEF.Tang/Exceptions/IllegalStateException.cs index 66bfbe4..6736e10 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/IllegalStateException.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/IllegalStateException.cs @@ -19,10 +19,9 @@ using System; namespace Org.Apache.REEF.Tang.Exceptions { - public class IllegalStateException : Exception + public sealed class IllegalStateException : Exception { public IllegalStateException() - : base() { } http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Exceptions/InjectionException.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Exceptions/InjectionException.cs b/lang/cs/Org.Apache.REEF.Tang/Exceptions/InjectionException.cs index 438e6e6..4fc991c 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/InjectionException.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/InjectionException.cs @@ -19,14 +19,14 @@ using System; namespace Org.Apache.REEF.Tang.Exceptions { - public class InjectionException : Exception + public sealed class InjectionException : Exception { - public InjectionException(string msg) + internal InjectionException(string msg) : base(msg) { } - public InjectionException(string message, Exception innerException) + internal InjectionException(string message, Exception innerException) : base(message, innerException) { } http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Exceptions/NameResolutionException.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Exceptions/NameResolutionException.cs b/lang/cs/Org.Apache.REEF.Tang/Exceptions/NameResolutionException.cs index 4cd6578..e847502 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/NameResolutionException.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/NameResolutionException.cs @@ -19,16 +19,15 @@ using System; namespace Org.Apache.REEF.Tang.Exceptions { - public class NameResolutionException : BindException + public sealed class NameResolutionException : BindException { - // private static readonly long serialVersionUID = 1L; - public NameResolutionException(string name, string longestPrefix) : + internal NameResolutionException(string name, string longestPrefix) : base(string.Format("Could not resolve {0}. Search ended at prefix {1}. This can happen due to typos in class names that are passed as strings, or because Tang uses Assembly loader other than the one that generated the class reference ((make sure you use the full name of a class)", name, longestPrefix)) { } - public NameResolutionException(string message, Exception innerException) + internal NameResolutionException(string message, Exception innerException) : base(message, innerException) { } http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Exceptions/ParseException.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Exceptions/ParseException.cs b/lang/cs/Org.Apache.REEF.Tang/Exceptions/ParseException.cs index 91c929d..ed98706 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/ParseException.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/ParseException.cs @@ -19,15 +19,14 @@ using System; namespace Org.Apache.REEF.Tang.Exceptions { - public class ParseException : BindException + public sealed class ParseException : BindException { - // private static readonly long serialVersionUID = 1L; - public ParseException(string message) + internal ParseException(string message) : base(message) { } - public ParseException(string message, Exception innerException) + internal ParseException(string message, Exception innerException) : base(message, innerException) { } http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Formats/AvroConfigurationDataContract/AvroConfiguration.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Formats/AvroConfigurationDataContract/AvroConfiguration.cs b/lang/cs/Org.Apache.REEF.Tang/Formats/AvroConfigurationDataContract/AvroConfiguration.cs index 48f2513..31c0197 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Formats/AvroConfigurationDataContract/AvroConfiguration.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Formats/AvroConfigurationDataContract/AvroConfiguration.cs @@ -23,8 +23,12 @@ namespace Org.Apache.REEF.Tang.Formats.AvroConfigurationDataContract { [KnownType(typeof(HashSet<ConfigurationEntry>))] [DataContract(Name = "AvroConfiguration", Namespace = "org.apache.reef.tang.formats.avro")] - public class AvroConfiguration + public sealed class AvroConfiguration { + public AvroConfiguration() + { + } + public AvroConfiguration(string language, ISet<ConfigurationEntry> bindings) { // TODO: [REEF-276] AvroSerializer currently does not serialize HashSets @@ -34,10 +38,6 @@ namespace Org.Apache.REEF.Tang.Formats.AvroConfigurationDataContract this.language = language; } - public AvroConfiguration() - { - } - [DataMember] public string language { get; set; } http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Formats/ConfigurationFile.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Formats/ConfigurationFile.cs b/lang/cs/Org.Apache.REEF.Tang/Formats/ConfigurationFile.cs index fd78576..3edaa30 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Formats/ConfigurationFile.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Formats/ConfigurationFile.cs @@ -31,7 +31,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Formats { - public class ConfigurationFile + public static class ConfigurationFile { private static readonly Logger LOGGER = Logger.GetLogger(typeof(ConfigurationFile)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Formats/ConfigurationModuleBuilder.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Formats/ConfigurationModuleBuilder.cs b/lang/cs/Org.Apache.REEF.Tang/Formats/ConfigurationModuleBuilder.cs index 16d9cb9..7701a1f 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Formats/ConfigurationModuleBuilder.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Formats/ConfigurationModuleBuilder.cs @@ -56,25 +56,25 @@ namespace Org.Apache.REEF.Tang.Formats { var e = new ClassHierarchyException( "Found a field of type " + t + " which should be a Required/Optional Parameter/Implementation instead"); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); } if (ParamTypes.Contains(t.Name)) { if (!f.IsPublic) { var e = new ClassHierarchyException("Found a non-public configuration option in " + GetType() + ": " + f); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); } if (!f.IsStatic) { var e = new ClassHierarchyException("Found a non-static configuration option in " + GetType() + ": " + f); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); } if (!f.IsInitOnly) { var e = new ClassHierarchyException("Found a non-readonly configuration option in " + GetType() + ": " + f); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); } object o = null; try @@ -83,15 +83,15 @@ namespace Org.Apache.REEF.Tang.Formats } catch (ArgumentException e) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); var ex = new ClassHierarchyException("Could not look up field instance in " + GetType() + " field: " + f, e); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } catch (FieldAccessException e) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); var ex = new ClassHierarchyException("Could not look up field instance in " + GetType() + " field: " + f, e); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } if (Map.ContainsKey(o)) @@ -99,7 +99,7 @@ namespace Org.Apache.REEF.Tang.Formats FieldInfo fi; Map.TryGetValue(o, out fi); var e = new ClassHierarchyException("Detected aliased instances in class " + GetType() + " for fields " + fi + " and " + f); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); } if (ReflectionUtilities.IsGenericTypeof(typeof(RequiredImpl<>), t) || ReflectionUtilities.IsGenericTypeof(typeof(RequiredParameter<>), t)) { @@ -122,9 +122,9 @@ namespace Org.Apache.REEF.Tang.Formats } catch (BindException e) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); var ex = new ClassHierarchyException("Build error in ConfigurationModuleBuilder: " + e); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } ReqDecl.UnionWith(c.ReqDecl); OptDecl.UnionWith(c.OptDecl); @@ -142,7 +142,7 @@ namespace Org.Apache.REEF.Tang.Formats if (d == null) { var e = new NullReferenceException("If merge() was passed a static final field that is initialized to non-null, then this is almost certainly caused by a circular class dependency."); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); } try { @@ -150,9 +150,9 @@ namespace Org.Apache.REEF.Tang.Formats } catch (ClassHierarchyException ex) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(ex, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Caught(ex, Level.Error, LOGGER); var e = new ClassHierarchyException(ReflectionUtilities.GetAssemblyQualifiedName(GetType()) + ": detected attempt to merge with ConfigurationModule that has had set() called on it", ex); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); } ConfigurationModuleBuilder c = DeepCopy(); try @@ -161,9 +161,9 @@ namespace Org.Apache.REEF.Tang.Formats } catch (BindException ex) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(ex, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Caught(ex, Level.Error, LOGGER); var e = new ClassHierarchyException("Error in AddConfiguration in Merge: " + ex); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); } c.ReqDecl.AddAll(d.Builder.ReqDecl); c.OptDecl.AddAll(d.Builder.OptDecl); @@ -190,9 +190,9 @@ namespace Org.Apache.REEF.Tang.Formats } catch (BindException ex) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(ex, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Caught(ex, Level.Error, LOGGER); var e = new ClassHierarchyException("Error in BindSetEntry: " + ex); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); } return c; } @@ -208,9 +208,9 @@ namespace Org.Apache.REEF.Tang.Formats } catch (BindException ex) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(ex, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Caught(ex, Level.Error, LOGGER); var e = new ClassHierarchyException("Error in BindSetEntry: " + ex); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); } return c; } @@ -257,7 +257,7 @@ namespace Org.Apache.REEF.Tang.Formats } catch (BindException ex) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.CaughtAndThrow(new ClassHierarchyException("Error in BindList: " + ex), Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.CaughtAndThrow(new ClassHierarchyException("Error in BindList: " + ex), Level.Error, LOGGER); } return c; } @@ -294,8 +294,8 @@ namespace Org.Apache.REEF.Tang.Formats } catch (BindException e) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new ClassHierarchyException("Error in BindImplementation: ", e), LOGGER); + Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(new ClassHierarchyException("Error in BindImplementation: ", e), LOGGER); } return c; } @@ -328,8 +328,8 @@ namespace Org.Apache.REEF.Tang.Formats } catch (BindException e) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new ClassHierarchyException("Error in BindNamedParameter: ", e), LOGGER); + Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(new ClassHierarchyException("Error in BindNamedParameter: ", e), LOGGER); } return c; } @@ -357,8 +357,8 @@ namespace Org.Apache.REEF.Tang.Formats } catch (BindException e) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new ClassHierarchyException("Error in BindNamedParameter: ", e), LOGGER); + Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(new ClassHierarchyException("Error in BindNamedParameter: ", e), LOGGER); } return c; } @@ -373,8 +373,8 @@ namespace Org.Apache.REEF.Tang.Formats } catch (BindException e) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new ClassHierarchyException("Error in BindNamedParameter: ", e), LOGGER); + Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(new ClassHierarchyException("Error in BindNamedParameter: ", e), LOGGER); } return c; } @@ -412,8 +412,8 @@ namespace Org.Apache.REEF.Tang.Formats } catch (BindException e) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new ClassHierarchyException("Error in BindConstructor: ", e), LOGGER); + Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(new ClassHierarchyException("Error in BindConstructor: ", e), LOGGER); } return c; } @@ -453,7 +453,7 @@ namespace Org.Apache.REEF.Tang.Formats var e = new ClassHierarchyException( "Found declared options that were not used in binds: " + ToString(fset)); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); } foreach (Type clz in c.lateBindClazz.Keys) { @@ -463,15 +463,15 @@ namespace Org.Apache.REEF.Tang.Formats } catch (NameResolutionException e) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); var ex = new ClassHierarchyException("ConfigurationModule refers to unknown class: " + c.lateBindClazz.Get(clz), e); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } catch (BindException e) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); var ex = new ClassHierarchyException("bind failed while initializing ConfigurationModuleBuilder", e); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } } return new ConfigurationModule(c); @@ -502,7 +502,7 @@ namespace Org.Apache.REEF.Tang.Formats if (f == null) { var e = new ClassHierarchyException("Unknown Impl/Param when binding " + impl.GetType().Name + ". Did you pass in a field from some other module?"); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(e, LOGGER); } if (!reqUsed.Contains(f)) { http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AbstractNode.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AbstractNode.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AbstractNode.cs index 536a2b9..cf059c0 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AbstractNode.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AbstractNode.cs @@ -22,7 +22,7 @@ using Org.Apache.REEF.Tang.Util; namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy { - public class AbstractNode : INode + internal abstract class AbstractNode : INode { /// It is from Type.FullName. This name is used as Name in a Node. /// It is not unique for a generic type with different type of arguments. @@ -39,7 +39,7 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy // children in the class hierarchy protected IDictionary<string, INode> children = new MonotonicTreeMap<string, INode>(); - public AbstractNode(INode parent, string name, string fullName) + protected AbstractNode(INode parent, string name, string fullName) { this.parent = parent; this.name = name; http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AvroClassHierarchySerializer.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AvroClassHierarchySerializer.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AvroClassHierarchySerializer.cs index 154be50..003f4b8 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AvroClassHierarchySerializer.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AvroClassHierarchySerializer.cs @@ -36,7 +36,7 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy /// <summary> /// AvroClassHierarchySerializer is to serialize and deserialize ClassHierarchy /// </summary> - public class AvroClassHierarchySerializer : IClassHierarchySerializer + internal sealed class AvroClassHierarchySerializer : IClassHierarchySerializer { private static readonly Logger LOGGER = Logger.GetLogger(typeof(AvroClassHierarchySerializer)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ClassHierarchyImpl.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ClassHierarchyImpl.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ClassHierarchyImpl.cs index 183d1bb..cda3660 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ClassHierarchyImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ClassHierarchyImpl.cs @@ -31,7 +31,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy { - public class ClassHierarchyImpl : ICsClassHierarchy + internal sealed class ClassHierarchyImpl : ICsClassHierarchy { private static readonly Logger LOGGER = Logger.GetLogger(typeof(ClassHierarchyImpl)); private readonly INode rootNode; http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ClassNodeImpl.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ClassNodeImpl.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ClassNodeImpl.cs index f71b346..85d9dab 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ClassNodeImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ClassNodeImpl.cs @@ -25,7 +25,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy { - public class ClassNodeImpl : AbstractNode, IClassNode + internal sealed class ClassNodeImpl : AbstractNode, IClassNode { private static readonly Logger LOGGER = Logger.GetLogger(typeof(ClassNodeImpl)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ConstructorArgImpl.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ConstructorArgImpl.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ConstructorArgImpl.cs index 005214d..eaf8501 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ConstructorArgImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ConstructorArgImpl.cs @@ -15,12 +15,11 @@ // specific language governing permissions and limitations // under the License. -using System; using Org.Apache.REEF.Tang.Types; namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy { - public class ConstructorArgImpl : IConstructorArg + internal sealed class ConstructorArgImpl : IConstructorArg { private readonly string type; private readonly string name; http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ConstructorDefImpl.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ConstructorDefImpl.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ConstructorDefImpl.cs index 7f538cf..004a540 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ConstructorDefImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ConstructorDefImpl.cs @@ -15,7 +15,6 @@ // specific language governing permissions and limitations // under the License. -using System; using System.Collections.Generic; using System.Linq; using System.Text; @@ -25,7 +24,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy { - public class ConstructorDefImpl : IConstructorDef + internal sealed class ConstructorDefImpl : IConstructorDef { private static readonly Logger LOGGER = Logger.GetLogger(typeof(ConstructorDefImpl)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/NamedParameterNodeImpl.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/NamedParameterNodeImpl.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/NamedParameterNodeImpl.cs index d1f1bb0..0264467 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/NamedParameterNodeImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/NamedParameterNodeImpl.cs @@ -15,14 +15,12 @@ // specific language governing permissions and limitations // under the License. -using System; -using Org.Apache.REEF.Tang.Annotations; using Org.Apache.REEF.Tang.Types; using Org.Apache.REEF.Tang.Util; namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy { - public class NamedParameterNodeImpl : AbstractNode, INamedParameterNode + internal sealed class NamedParameterNodeImpl : AbstractNode, INamedParameterNode { private readonly string fullArgName; private readonly string simpleArgName; http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/NodeFactory.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/NodeFactory.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/NodeFactory.cs index ff7b5ba..f7150e5 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/NodeFactory.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/NodeFactory.cs @@ -28,7 +28,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy { - public class NodeFactory + internal static class NodeFactory { private static readonly Logger LOGGER = Logger.GetLogger(typeof(NodeFactory)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/PackageNodeImpl.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/PackageNodeImpl.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/PackageNodeImpl.cs index 6b7dae5..1cf794a 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/PackageNodeImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/PackageNodeImpl.cs @@ -20,7 +20,7 @@ using Org.Apache.REEF.Tang.Types; namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy { - public class PackageNodeImpl : AbstractNode, IPackageNode + internal sealed class PackageNodeImpl : AbstractNode, IPackageNode { public PackageNodeImpl(INode parent, string name, string fullName) : base(parent, name, fullName) http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ParameterParser.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ParameterParser.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ParameterParser.cs index 456299f..8fa30bc 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ParameterParser.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ParameterParser.cs @@ -25,7 +25,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy { - public class ParameterParser + internal sealed class ParameterParser { private static readonly Logger LOGGER = Logger.GetLogger(typeof(ParameterParser)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/ConfigurationBuilderImpl.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/ConfigurationBuilderImpl.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/ConfigurationBuilderImpl.cs index 6b601a3..ab850fb 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/ConfigurationBuilderImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/ConfigurationBuilderImpl.cs @@ -29,7 +29,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Implementations.Configuration { - public class ConfigurationBuilderImpl : IConfigurationBuilder + internal class ConfigurationBuilderImpl : IConfigurationBuilder { public IClassHierarchy ClassHierarchy; http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/ConfigurationImpl.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/ConfigurationImpl.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/ConfigurationImpl.cs index 61306d9..2a3ce89 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/ConfigurationImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/ConfigurationImpl.cs @@ -15,14 +15,13 @@ // specific language governing permissions and limitations // under the License. -using System; using System.Collections.Generic; using Org.Apache.REEF.Tang.Interface; using Org.Apache.REEF.Tang.Types; namespace Org.Apache.REEF.Tang.Implementations.Configuration { - public class ConfigurationImpl : IConfiguration + internal class ConfigurationImpl : IConfiguration { public readonly ConfigurationBuilderImpl Builder; http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/Configurations.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/Configurations.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/Configurations.cs index a655cf4..e9e3409 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/Configurations.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/Configurations.cs @@ -21,7 +21,7 @@ using Org.Apache.REEF.Tang.Protobuf; namespace Org.Apache.REEF.Tang.Implementations.Configuration { - public class Configurations + public static class Configurations { public static IConfiguration Merge(params IConfiguration[] configurations) { http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/CsConfigurationBuilderImpl.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/CsConfigurationBuilderImpl.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/CsConfigurationBuilderImpl.cs index bbba7d5..569d467 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/CsConfigurationBuilderImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/CsConfigurationBuilderImpl.cs @@ -27,7 +27,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Implementations.Configuration { - public class CsConfigurationBuilderImpl : ConfigurationBuilderImpl, ICsInternalConfigurationBuilder + internal sealed class CsConfigurationBuilderImpl : ConfigurationBuilderImpl, ICsInternalConfigurationBuilder { private static readonly Logger LOGGER = Logger.GetLogger(typeof(CsConfigurationBuilderImpl)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/CsConfigurationImpl.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/CsConfigurationImpl.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/CsConfigurationImpl.cs index f20830e..b78f5af 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/CsConfigurationImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/Configuration/CsConfigurationImpl.cs @@ -17,7 +17,7 @@ namespace Org.Apache.REEF.Tang.Implementations.Configuration { - public class CsConfigurationImpl : ConfigurationImpl + internal sealed class CsConfigurationImpl : ConfigurationImpl { public CsConfigurationImpl(CsConfigurationBuilderImpl builder) : base(builder) { http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/Constructor.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/Constructor.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/Constructor.cs index 8582855..ec8133c 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/Constructor.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/Constructor.cs @@ -26,7 +26,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Implementations.InjectionPlan { // Base case for an injection plan. A plan for a class. - public class Constructor : InjectionPlan + internal sealed class Constructor : InjectionPlan { private static readonly Logger LOGGER = Logger.GetLogger(typeof(Constructor)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/CsInstance.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/CsInstance.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/CsInstance.cs index 7fbdc1a..02e5d62 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/CsInstance.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/CsInstance.cs @@ -21,7 +21,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Implementations.InjectionPlan { - public class CsInstance : InjectionPlan + internal sealed class CsInstance : InjectionPlan { public readonly object instance; private static readonly Logger LOGGER = Logger.GetLogger(typeof(CsInstance)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionFuture.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionFuture.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionFuture.cs index 828fbab..501b823 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionFuture.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionFuture.cs @@ -27,10 +27,10 @@ namespace Org.Apache.REEF.Tang.Implementations.InjectionPlan T Get(); } - public class InjectionFutureImpl<T> : IInjectionFuture<T> + public sealed class InjectionFutureImpl<T> : IInjectionFuture<T> { - protected readonly InjectorImpl injector; - private readonly Type iface; // extend from T + private readonly InjectorImpl injector; + private readonly Type iface; // entend from T private readonly T instance; ////public InjectionFuture() http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionFuturePlan.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionFuturePlan.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionFuturePlan.cs index 762cac2..54fdc2a 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionFuturePlan.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionFuturePlan.cs @@ -17,14 +17,11 @@ using System; using Org.Apache.REEF.Tang.Types; -using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Implementations.InjectionPlan { - public class InjectionFuturePlan : InjectionPlan + internal sealed class InjectionFuturePlan : InjectionPlan { - private static readonly Logger LOGGER = Logger.GetLogger(typeof(InjectionFuturePlan)); - public InjectionFuturePlan(INode name) : base(name) { } http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionPlan.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionPlan.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionPlan.cs index 85fc8be..543ad47 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionPlan.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectionPlan.cs @@ -30,7 +30,7 @@ namespace Org.Apache.REEF.Tang.Implementations.InjectionPlan private static readonly Logger LOGGER = Logger.GetLogger(typeof(InjectionPlan)); - public InjectionPlan(INode node) + protected InjectionPlan(INode node) { this.node = node; } @@ -169,7 +169,7 @@ namespace Org.Apache.REEF.Tang.Implementations.InjectionPlan public abstract string ToShallowString(); } - public class BuildingInjectionPlan : InjectionPlan + internal sealed class BuildingInjectionPlan : InjectionPlan { public BuildingInjectionPlan(INode node) : base(node) http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectorImpl.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectorImpl.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectorImpl.cs index cb0c1d4..8220967 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectorImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/InjectorImpl.cs @@ -31,7 +31,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Implementations.InjectionPlan { - public class InjectorImpl : IInjector + internal sealed class InjectorImpl : IInjector { private static readonly Logger LOGGER = Logger.GetLogger(typeof(InjectorImpl)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/ListInjectionPlan.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/ListInjectionPlan.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/ListInjectionPlan.cs index 86a6921..302b2ba 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/ListInjectionPlan.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/ListInjectionPlan.cs @@ -21,7 +21,7 @@ using Org.Apache.REEF.Tang.Types; namespace Org.Apache.REEF.Tang.Implementations.InjectionPlan { - public class ListInjectionPlan : InjectionPlan + internal sealed class ListInjectionPlan : InjectionPlan { private readonly IList<InjectionPlan> entries = new List<InjectionPlan>(); private readonly int numAlternatives; http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/SetInjectionPlan.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/SetInjectionPlan.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/SetInjectionPlan.cs index d454986..3ebb7c1 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/SetInjectionPlan.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/SetInjectionPlan.cs @@ -22,7 +22,7 @@ using Org.Apache.REEF.Tang.Util; namespace Org.Apache.REEF.Tang.Implementations.InjectionPlan { - public class SetInjectionPlan : InjectionPlan + internal sealed class SetInjectionPlan : InjectionPlan { private readonly ISet<InjectionPlan> entries = new MonotonicHashSet<InjectionPlan>(); private readonly int numAlternatives; http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/Subplan.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/Subplan.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/Subplan.cs index e4fb6aa..8ffeb6c 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/Subplan.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/InjectionPlan/Subplan.cs @@ -26,7 +26,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Implementations.InjectionPlan { - public class Subplan : InjectionPlan + internal sealed class Subplan : InjectionPlan { private static readonly Logger LOGGER = Logger.GetLogger(typeof(Subplan)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/Tang/TangFactory.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/Tang/TangFactory.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/Tang/TangFactory.cs index 3ffc506..af96787 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/Tang/TangFactory.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/Tang/TangFactory.cs @@ -19,7 +19,7 @@ using Org.Apache.REEF.Tang.Interface; namespace Org.Apache.REEF.Tang.Implementations.Tang { - public class TangFactory + public static class TangFactory { public static ITang GetTang() { http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Implementations/Tang/TangImpl.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/Tang/TangImpl.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/Tang/TangImpl.cs index 0522fb9..f0aa7df 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/Tang/TangImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/Tang/TangImpl.cs @@ -28,7 +28,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Implementations.Tang { - public class TangImpl : ITang + internal sealed class TangImpl : ITang { private static readonly Logger LOGGER = Logger.GetLogger(typeof(TangImpl)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Protobuf/ProtocolBufferClassHierarchy.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Protobuf/ProtocolBufferClassHierarchy.cs b/lang/cs/Org.Apache.REEF.Tang/Protobuf/ProtocolBufferClassHierarchy.cs index 09345de..6cb06d2 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Protobuf/ProtocolBufferClassHierarchy.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Protobuf/ProtocolBufferClassHierarchy.cs @@ -30,7 +30,7 @@ using ProtoBuf; namespace Org.Apache.REEF.Tang.Protobuf { - public class ProtocolBufferClassHierarchy : IClassHierarchy + public sealed class ProtocolBufferClassHierarchy : IClassHierarchy { private static readonly Logger LOGGER = Logger.GetLogger(typeof(ProtocolBufferClassHierarchy)); @@ -40,22 +40,22 @@ namespace Org.Apache.REEF.Tang.Protobuf public static void Serialize(string fileName, IClassHierarchy classHierarchy) { - Org.Apache.REEF.Tang.Protobuf.Node node = Serialize(classHierarchy); + Node node = Serialize(classHierarchy); using (var file = File.Create(fileName)) { - Serializer.Serialize<Org.Apache.REEF.Tang.Protobuf.Node>(file, node); + Serializer.Serialize<Node>(file, node); } } - public static Org.Apache.REEF.Tang.Protobuf.Node Serialize(IClassHierarchy classHierarchy) + public static Node Serialize(IClassHierarchy classHierarchy) { return SerializeNode(classHierarchy.GetNamespace()); } - private static Org.Apache.REEF.Tang.Protobuf.Node SerializeNode(INode n) + private static Node SerializeNode(INode n) { - IList<Org.Apache.REEF.Tang.Protobuf.Node> children = new List<Org.Apache.REEF.Tang.Protobuf.Node>(); + IList<Node> children = new List<Node>(); foreach (INode child in n.GetChildren()) { @@ -74,13 +74,13 @@ namespace Org.Apache.REEF.Tang.Protobuf others.Remove(c); } - IList<Org.Apache.REEF.Tang.Protobuf.ConstructorDef> injectableConstructors = new List<Org.Apache.REEF.Tang.Protobuf.ConstructorDef>(); + IList<ConstructorDef> injectableConstructors = new List<ConstructorDef>(); foreach (IConstructorDef inj in injectable) { injectableConstructors.Add(SerializeConstructorDef(inj)); } - IList<Org.Apache.REEF.Tang.Protobuf.ConstructorDef> otherConstructors = new List<Org.Apache.REEF.Tang.Protobuf.ConstructorDef>(); + IList<ConstructorDef> otherConstructors = new List<ConstructorDef>(); foreach (IConstructorDef other in others) { otherConstructors.Add(SerializeConstructorDef(other)); @@ -107,13 +107,13 @@ namespace Org.Apache.REEF.Tang.Protobuf { return NewPackageNode(n.GetName(), n.GetFullName(), children); } - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new IllegalStateException("Encountered unknown type of Node: " + n), LOGGER); + Utilities.Diagnostics.Exceptions.Throw(new IllegalStateException("Encountered unknown type of Node: " + n), LOGGER); return null; } - private static Org.Apache.REEF.Tang.Protobuf.ConstructorDef SerializeConstructorDef(IConstructorDef def) + private static ConstructorDef SerializeConstructorDef(IConstructorDef def) { - IList<Org.Apache.REEF.Tang.Protobuf.ConstructorArg> args = new List<Org.Apache.REEF.Tang.Protobuf.ConstructorArg>(); + IList<ConstructorArg> args = new List<ConstructorArg>(); foreach (IConstructorArg arg in def.GetArgs()) { args.Add(NewConstructorArg(arg.Gettype(), arg.GetNamedParameterName(), arg.IsInjectionFuture())); @@ -121,22 +121,22 @@ namespace Org.Apache.REEF.Tang.Protobuf return newConstructorDef(def.GetClassName(), args); } - private static Org.Apache.REEF.Tang.Protobuf.ConstructorArg NewConstructorArg( + private static ConstructorArg NewConstructorArg( string fullArgClassName, string namedParameterName, bool isFuture) { - Org.Apache.REEF.Tang.Protobuf.ConstructorArg constArg = new Org.Apache.REEF.Tang.Protobuf.ConstructorArg(); + ConstructorArg constArg = new ConstructorArg(); constArg.full_arg_class_name = fullArgClassName; constArg.named_parameter_name = namedParameterName; constArg.is_injection_future = isFuture; return constArg; } - private static Org.Apache.REEF.Tang.Protobuf.ConstructorDef newConstructorDef( - string fullClassName, IList<Org.Apache.REEF.Tang.Protobuf.ConstructorArg> args) + private static ConstructorDef newConstructorDef( + string fullClassName, IList<ConstructorArg> args) { - Org.Apache.REEF.Tang.Protobuf.ConstructorDef constDef = new Org.Apache.REEF.Tang.Protobuf.ConstructorDef(); + ConstructorDef constDef = new ConstructorDef(); constDef.full_class_name = fullClassName; - foreach (Org.Apache.REEF.Tang.Protobuf.ConstructorArg arg in args) + foreach (ConstructorArg arg in args) { constDef.args.Add(arg); } @@ -144,14 +144,14 @@ namespace Org.Apache.REEF.Tang.Protobuf return constDef; } - private static Org.Apache.REEF.Tang.Protobuf.Node NewClassNode(string name, + private static Node NewClassNode(string name, string fullName, bool isInjectionCandidate, bool isExternalConstructor, bool isUnit, - IList<Org.Apache.REEF.Tang.Protobuf.ConstructorDef> injectableConstructors, - IList<Org.Apache.REEF.Tang.Protobuf.ConstructorDef> otherConstructors, - IList<string> implFullNames, IList<Org.Apache.REEF.Tang.Protobuf.Node> children) + IList<ConstructorDef> injectableConstructors, + IList<ConstructorDef> otherConstructors, + IList<string> implFullNames, IList<Node> children) { - Org.Apache.REEF.Tang.Protobuf.ClassNode classNode = new Org.Apache.REEF.Tang.Protobuf.ClassNode(); + ClassNode classNode = new ClassNode(); classNode.is_injection_candidate = isInjectionCandidate; foreach (var ic in injectableConstructors) { @@ -167,7 +167,7 @@ namespace Org.Apache.REEF.Tang.Protobuf classNode.impl_full_names.Add(implFullName); } - Org.Apache.REEF.Tang.Protobuf.Node n = new Org.Apache.REEF.Tang.Protobuf.Node(); + Node n = new Node(); n.name = name; n.full_name = fullName; n.class_node = classNode; @@ -180,15 +180,15 @@ namespace Org.Apache.REEF.Tang.Protobuf return n; } - private static Org.Apache.REEF.Tang.Protobuf.Node NewNamedParameterNode(string name, + private static Node NewNamedParameterNode(string name, string fullName, string simpleArgClassName, string fullArgClassName, bool isSet, bool isList, string documentation, // can be null string shortName, // can be null string[] instanceDefault, // can be null - IList<Org.Apache.REEF.Tang.Protobuf.Node> children, + IList<Node> children, string alias, Language aliasLanguage) { - Org.Apache.REEF.Tang.Protobuf.NamedParameterNode namedParameterNode = new Org.Apache.REEF.Tang.Protobuf.NamedParameterNode(); + NamedParameterNode namedParameterNode = new NamedParameterNode(); namedParameterNode.simple_arg_class_name = simpleArgClassName; namedParameterNode.full_arg_class_name = fullArgClassName; namedParameterNode.is_set = isSet; @@ -216,7 +216,7 @@ namespace Org.Apache.REEF.Tang.Protobuf namedParameterNode.instance_default.Add(id); } - Org.Apache.REEF.Tang.Protobuf.Node n = new Org.Apache.REEF.Tang.Protobuf.Node(); + Node n = new Node(); n.name = name; n.full_name = fullName; n.named_parameter_node = namedParameterNode; @@ -229,11 +229,11 @@ namespace Org.Apache.REEF.Tang.Protobuf return n; } - private static Org.Apache.REEF.Tang.Protobuf.Node NewPackageNode(string name, - string fullName, IList<Org.Apache.REEF.Tang.Protobuf.Node> children) + private static Node NewPackageNode(string name, + string fullName, IList<Node> children) { - Org.Apache.REEF.Tang.Protobuf.PackageNode packageNode = new Org.Apache.REEF.Tang.Protobuf.PackageNode(); - Org.Apache.REEF.Tang.Protobuf.Node n = new Org.Apache.REEF.Tang.Protobuf.Node(); + PackageNode packageNode = new PackageNode(); + Node n = new Node(); n.name = name; n.full_name = fullName; n.package_node = packageNode; @@ -248,11 +248,11 @@ namespace Org.Apache.REEF.Tang.Protobuf public static IClassHierarchy DeSerialize(string fileName) { - Org.Apache.REEF.Tang.Protobuf.Node root; + Node root; using (var file = File.OpenRead(fileName)) { - root = Serializer.Deserialize<Org.Apache.REEF.Tang.Protobuf.Node>(file); + root = Serializer.Deserialize<Node>(file); } return new ProtocolBufferClassHierarchy(root); @@ -264,23 +264,23 @@ namespace Org.Apache.REEF.Tang.Protobuf this.rootNode = new PackageNodeImpl(); } - public ProtocolBufferClassHierarchy(Org.Apache.REEF.Tang.Protobuf.Node root) + public ProtocolBufferClassHierarchy(Node root) { this.rootNode = new PackageNodeImpl(); if (root.package_node == null) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new ArgumentException("Expected a package node. Got: " + root), LOGGER); + Utilities.Diagnostics.Exceptions.Throw(new ArgumentException("Expected a package node. Got: " + root), LOGGER); } // Register all the classes. - foreach (Org.Apache.REEF.Tang.Protobuf.Node child in root.children) + foreach (Node child in root.children) { ParseSubHierarchy(rootNode, child); } BuildHashTable(rootNode); - foreach (Org.Apache.REEF.Tang.Protobuf.Node child in root.children) + foreach (Node child in root.children) { WireUpInheritanceRelationships(child); } @@ -322,7 +322,7 @@ namespace Org.Apache.REEF.Tang.Protobuf } } - private static void ParseSubHierarchy(INode parent, Org.Apache.REEF.Tang.Protobuf.Node n) + private static void ParseSubHierarchy(INode parent, Node n) { INode parsed = null; if (n.package_node != null) @@ -331,7 +331,7 @@ namespace Org.Apache.REEF.Tang.Protobuf } else if (n.named_parameter_node != null) { - Org.Apache.REEF.Tang.Protobuf.NamedParameterNode np = n.named_parameter_node; + NamedParameterNode np = n.named_parameter_node; if (!string.IsNullOrWhiteSpace(np.alias_name) && !string.IsNullOrWhiteSpace(np.alias_language)) { @@ -361,17 +361,17 @@ namespace Org.Apache.REEF.Tang.Protobuf } else if (n.class_node != null) { - Org.Apache.REEF.Tang.Protobuf.ClassNode cn = n.class_node; + ClassNode cn = n.class_node; IList<IConstructorDef> injectableConstructors = new List<IConstructorDef>(); IList<IConstructorDef> allConstructors = new List<IConstructorDef>(); - foreach (Org.Apache.REEF.Tang.Protobuf.ConstructorDef injectable in cn.InjectableConstructors) + foreach (ConstructorDef injectable in cn.InjectableConstructors) { IConstructorDef def = ParseConstructorDef(injectable, true); injectableConstructors.Add(def); allConstructors.Add(def); } - foreach (Org.Apache.REEF.Tang.Protobuf.ConstructorDef other in cn.OtherConstructors) + foreach (ConstructorDef other in cn.OtherConstructors) { IConstructorDef def = ParseConstructorDef(other, false); allConstructors.Add(def); @@ -385,30 +385,30 @@ namespace Org.Apache.REEF.Tang.Protobuf } else { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new IllegalStateException("Bad protocol buffer: got abstract node" + n), LOGGER); + Utilities.Diagnostics.Exceptions.Throw(new IllegalStateException("Bad protocol buffer: got abstract node" + n), LOGGER); } - foreach (Org.Apache.REEF.Tang.Protobuf.Node child in n.children) + foreach (Node child in n.children) { ParseSubHierarchy(parsed, child); } } - private static IConstructorDef ParseConstructorDef(Org.Apache.REEF.Tang.Protobuf.ConstructorDef def, bool isInjectable) + private static IConstructorDef ParseConstructorDef(ConstructorDef def, bool isInjectable) { IList<IConstructorArg> args = new List<IConstructorArg>(); - foreach (Org.Apache.REEF.Tang.Protobuf.ConstructorArg arg in def.args) + foreach (ConstructorArg arg in def.args) { args.Add(new ConstructorArgImpl(arg.full_arg_class_name, arg.named_parameter_name, arg.is_injection_future)); } return new ConstructorDefImpl(def.full_class_name, args.ToArray(), isInjectable); } - private void WireUpInheritanceRelationships(Org.Apache.REEF.Tang.Protobuf.Node n) + private void WireUpInheritanceRelationships(Node n) { if (n.class_node != null) { - Org.Apache.REEF.Tang.Protobuf.ClassNode cn = n.class_node; + ClassNode cn = n.class_node; IClassNode iface = null; try { @@ -419,7 +419,7 @@ namespace Org.Apache.REEF.Tang.Protobuf Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); var ex = new IllegalStateException("When reading protocol buffer node " + n.full_name + " does not exist. Full record is " + n, e); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } foreach (string impl in cn.impl_full_names) { @@ -429,28 +429,28 @@ namespace Org.Apache.REEF.Tang.Protobuf } catch (NameResolutionException e) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); var ex = new IllegalStateException("When reading protocol buffer node " + n + " refers to non-existent implementation:" + impl); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } catch (InvalidCastException e) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Caught(e, Level.Error, LOGGER); try { var ex = new IllegalStateException( "When reading protocol buffer node " + n + " found implementation" + GetNode(impl) + " which is not a ClassNode!"); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } catch (NameResolutionException ne) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Caught(ne, Level.Error, LOGGER); + Utilities.Diagnostics.Exceptions.Caught(ne, Level.Error, LOGGER); var ex = new IllegalStateException( "Got 'cant happen' exception when producing error message for " + e); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } } } @@ -464,7 +464,7 @@ namespace Org.Apache.REEF.Tang.Protobuf if (ret == null) { var ex = new NameResolutionException(fullName, "Cannot resolve the name from the class hierarchy during deserialization: " + fullName); - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); + Utilities.Diagnostics.Exceptions.Throw(ex, LOGGER); } return ret; } @@ -522,7 +522,7 @@ namespace Org.Apache.REEF.Tang.Protobuf if (!(ch is ProtocolBufferClassHierarchy)) { - Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new NotSupportedException( + Utilities.Diagnostics.Exceptions.Throw(new NotSupportedException( "Cannot merge ExternalClassHierarchies yet!"), LOGGER); } http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Protobuf/ProtocolBufferInjectionPlan.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Protobuf/ProtocolBufferInjectionPlan.cs b/lang/cs/Org.Apache.REEF.Tang/Protobuf/ProtocolBufferInjectionPlan.cs index c2da557..0f2f5fb 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Protobuf/ProtocolBufferInjectionPlan.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Protobuf/ProtocolBufferInjectionPlan.cs @@ -28,84 +28,84 @@ using ProtoBuf; namespace Org.Apache.REEF.Tang.Protobuf { - public class ProtocolBufferInjectionPlan + internal sealed class ProtocolBufferInjectionPlan { private static readonly Logger LOGGER = Logger.GetLogger(typeof(ProtocolBufferInjectionPlan)); - private static Org.Apache.REEF.Tang.Protobuf.InjectionPlan NewConstructor(string fullName, List<Org.Apache.REEF.Tang.Protobuf.InjectionPlan> plans) + private static InjectionPlan NewConstructor(string fullName, List<InjectionPlan> plans) { - Org.Apache.REEF.Tang.Protobuf.Constructor cconstr = new Org.Apache.REEF.Tang.Protobuf.Constructor(); - foreach (Org.Apache.REEF.Tang.Protobuf.InjectionPlan p in plans) + Constructor cconstr = new Constructor(); + foreach (InjectionPlan p in plans) { cconstr.args.Add(p); } - Org.Apache.REEF.Tang.Protobuf.InjectionPlan plan = new Org.Apache.REEF.Tang.Protobuf.InjectionPlan(); + InjectionPlan plan = new InjectionPlan(); plan.name = fullName; plan.constructor = cconstr; return plan; } - private static Org.Apache.REEF.Tang.Protobuf.InjectionPlan NewSubplan(string fullName, int selectedPlan, List<Org.Apache.REEF.Tang.Protobuf.InjectionPlan> plans) + private static InjectionPlan NewSubplan(string fullName, int selectedPlan, List<InjectionPlan> plans) { - Org.Apache.REEF.Tang.Protobuf.Subplan subPlan = new Org.Apache.REEF.Tang.Protobuf.Subplan(); + Subplan subPlan = new Subplan(); subPlan.selected_plan = selectedPlan; - foreach (Org.Apache.REEF.Tang.Protobuf.InjectionPlan p in plans) + foreach (InjectionPlan p in plans) { subPlan.plans.Add(p); } - Org.Apache.REEF.Tang.Protobuf.InjectionPlan plan = new Org.Apache.REEF.Tang.Protobuf.InjectionPlan(); + InjectionPlan plan = new InjectionPlan(); plan.name = fullName; plan.subplan = subPlan; return plan; } - private static Org.Apache.REEF.Tang.Protobuf.InjectionPlan NewInstance(string fullName, string value) + private static InjectionPlan NewInstance(string fullName, string value) { - Org.Apache.REEF.Tang.Protobuf.Instance instance = new Org.Apache.REEF.Tang.Protobuf.Instance(); + Instance instance = new Instance(); instance.value = value; - Org.Apache.REEF.Tang.Protobuf.InjectionPlan plan = new Org.Apache.REEF.Tang.Protobuf.InjectionPlan(); + InjectionPlan plan = new InjectionPlan(); plan.name = fullName; plan.instance = instance; return plan; } - public static void Serialize(string fileName, Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan ip) + public static void Serialize(string fileName, Implementations.InjectionPlan.InjectionPlan ip) { - Org.Apache.REEF.Tang.Protobuf.InjectionPlan plan = Serialize(ip); + InjectionPlan plan = Serialize(ip); using (var file = File.Create(fileName)) { - Serializer.Serialize<Org.Apache.REEF.Tang.Protobuf.InjectionPlan>(file, plan); + Serializer.Serialize<InjectionPlan>(file, plan); } } - public static Org.Apache.REEF.Tang.Protobuf.InjectionPlan Serialize(Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan ip) + public static InjectionPlan Serialize(Implementations.InjectionPlan.InjectionPlan ip) { - if (ip is Org.Apache.REEF.Tang.Implementations.InjectionPlan.Constructor) + if (ip is Implementations.InjectionPlan.Constructor) { - Org.Apache.REEF.Tang.Implementations.InjectionPlan.Constructor cons = (Org.Apache.REEF.Tang.Implementations.InjectionPlan.Constructor)ip; - Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan[] args = cons.GetArgs(); - Org.Apache.REEF.Tang.Protobuf.InjectionPlan[] protoArgs = new Org.Apache.REEF.Tang.Protobuf.InjectionPlan[args.Length]; + Implementations.InjectionPlan.Constructor cons = (Implementations.InjectionPlan.Constructor)ip; + Implementations.InjectionPlan.InjectionPlan[] args = cons.GetArgs(); + InjectionPlan[] protoArgs = new InjectionPlan[args.Length]; for (int i = 0; i < args.Length; i++) { protoArgs[i] = Serialize(args[i]); } - return NewConstructor(ip.GetNode().GetFullName(), protoArgs.ToList<Org.Apache.REEF.Tang.Protobuf.InjectionPlan>()); + return NewConstructor(ip.GetNode().GetFullName(), protoArgs.ToList<InjectionPlan>()); } - if (ip is Org.Apache.REEF.Tang.Implementations.InjectionPlan.Subplan) + if (ip is Implementations.InjectionPlan.Subplan) { - Org.Apache.REEF.Tang.Implementations.InjectionPlan.Subplan sp = (Org.Apache.REEF.Tang.Implementations.InjectionPlan.Subplan)ip; - Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan[] args = sp.GetPlans(); - Org.Apache.REEF.Tang.Protobuf.InjectionPlan[] subPlans = new Org.Apache.REEF.Tang.Protobuf.InjectionPlan[args.Length]; + Implementations.InjectionPlan.Subplan sp = (Implementations.InjectionPlan.Subplan)ip; + Implementations.InjectionPlan.InjectionPlan[] args = sp.GetPlans(); + InjectionPlan[] subPlans = new InjectionPlan[args.Length]; for (int i = 0; i < args.Length; i++) { subPlans[i] = Serialize(args[i]); } - return NewSubplan(ip.GetNode().GetFullName(), sp.GetSelectedIndex(), subPlans.ToList<Org.Apache.REEF.Tang.Protobuf.InjectionPlan>()); + return NewSubplan(ip.GetNode().GetFullName(), sp.GetSelectedIndex(), subPlans.ToList<InjectionPlan>()); } if (ip is CsInstance) { @@ -117,27 +117,27 @@ namespace Org.Apache.REEF.Tang.Protobuf return null; } - public static Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan DeSerialize(string fileName, IClassHierarchy ch) + public static Implementations.InjectionPlan.InjectionPlan DeSerialize(string fileName, IClassHierarchy ch) { - Org.Apache.REEF.Tang.Protobuf.InjectionPlan protoPlan; + InjectionPlan protoPlan; using (var file = File.OpenRead(fileName)) { - protoPlan = Serializer.Deserialize<Org.Apache.REEF.Tang.Protobuf.InjectionPlan>(file); + protoPlan = Serializer.Deserialize<InjectionPlan>(file); } return Deserialize(ch, protoPlan); } - public static Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan Deserialize(IClassHierarchy ch, Org.Apache.REEF.Tang.Protobuf.InjectionPlan ip) + public static Implementations.InjectionPlan.InjectionPlan Deserialize(IClassHierarchy ch, InjectionPlan ip) { string fullName = ip.name; if (ip.constructor != null) { - Org.Apache.REEF.Tang.Protobuf.Constructor cons = ip.constructor; + Constructor cons = ip.constructor; IClassNode cn = (IClassNode)ch.GetNode(fullName); - Org.Apache.REEF.Tang.Protobuf.InjectionPlan[] protoBufArgs = cons.args.ToArray(); + InjectionPlan[] protoBufArgs = cons.args.ToArray(); IClassNode[] cnArgs = new IClassNode[protoBufArgs.Length]; @@ -155,34 +155,34 @@ namespace Org.Apache.REEF.Tang.Protobuf } } - Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan[] ipArgs = new Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan[protoBufArgs.Length]; + Implementations.InjectionPlan.InjectionPlan[] ipArgs = new Implementations.InjectionPlan.InjectionPlan[protoBufArgs.Length]; for (int i = 0; i < protoBufArgs.Length; i++) { - ipArgs[i] = (Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan)Deserialize(ch, protoBufArgs[i]); + ipArgs[i] = (Implementations.InjectionPlan.InjectionPlan)Deserialize(ch, protoBufArgs[i]); } IConstructorDef constructor = cn.GetConstructorDef(cnArgs); - return new Org.Apache.REEF.Tang.Implementations.InjectionPlan.Constructor(cn, constructor, ipArgs); + return new Implementations.InjectionPlan.Constructor(cn, constructor, ipArgs); } if (ip.instance != null) { - Org.Apache.REEF.Tang.Protobuf.Instance ins = ip.instance; + Instance ins = ip.instance; object instance = Parse(ip.name, ins.value); return new CsInstance(ch.GetNode(ip.name), instance); } if (ip.subplan != null) { - Org.Apache.REEF.Tang.Protobuf.Subplan subplan = ip.subplan; - Org.Apache.REEF.Tang.Protobuf.InjectionPlan[] protoBufPlans = subplan.plans.ToArray(); + Subplan subplan = ip.subplan; + InjectionPlan[] protoBufPlans = subplan.plans.ToArray(); - Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan[] subPlans = new Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan[protoBufPlans.Length]; + Implementations.InjectionPlan.InjectionPlan[] subPlans = new Implementations.InjectionPlan.InjectionPlan[protoBufPlans.Length]; for (int i = 0; i < protoBufPlans.Length; i++) { - subPlans[i] = (Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan)Deserialize(ch, protoBufPlans[i]); + subPlans[i] = (Implementations.InjectionPlan.InjectionPlan)Deserialize(ch, protoBufPlans[i]); } INode n = ch.GetNode(fullName); - return new Org.Apache.REEF.Tang.Implementations.InjectionPlan.Subplan(n, subPlans); + return new Implementations.InjectionPlan.Subplan(n, subPlans); } Org.Apache.REEF.Utilities.Diagnostics.Exceptions.Throw(new IllegalStateException("Encountered unknown type of InjectionPlan: " + ip), LOGGER); return null; http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Util/AbstractMonotonicMultiMap.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Util/AbstractMonotonicMultiMap.cs b/lang/cs/Org.Apache.REEF.Tang/Util/AbstractMonotonicMultiMap.cs index 93b9f75..021bca1 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Util/AbstractMonotonicMultiMap.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Util/AbstractMonotonicMultiMap.cs @@ -33,7 +33,7 @@ namespace Org.Apache.REEF.Tang.Util private int size = 0; - public AbstractMonotonicMultiMap(IDictionary<K, ISet<V>> map) + protected AbstractMonotonicMultiMap(IDictionary<K, ISet<V>> map) { this.map = map; } http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Util/AssemblyLoader.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Util/AssemblyLoader.cs b/lang/cs/Org.Apache.REEF.Tang/Util/AssemblyLoader.cs index 589522e..e4f03d3 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Util/AssemblyLoader.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Util/AssemblyLoader.cs @@ -23,7 +23,7 @@ using Org.Apache.REEF.Utilities.Logging; namespace Org.Apache.REEF.Tang.Util { - public class AssemblyLoader + public sealed class AssemblyLoader { private static readonly Logger LOGGER = Logger.GetLogger(typeof(AssemblyLoader)); http://git-wip-us.apache.org/repos/asf/reef/blob/96279b04/lang/cs/Org.Apache.REEF.Tang/Util/GenericType.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Util/GenericType.cs b/lang/cs/Org.Apache.REEF.Tang/Util/GenericType.cs index 68e8945..3204786 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Util/GenericType.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Util/GenericType.cs @@ -19,7 +19,7 @@ using System; namespace Org.Apache.REEF.Tang.Util { - public class GenericType<T> + public sealed class GenericType<T> { public static readonly GenericType<T> Class = null;
