[REEF-1055] Enable StyleCop.CSharp.ReadabilityRules and fix violations This enables the following rules: * CommentsMustContainText * DoNotPrefixCallsWithBaseUnlessLocalImplementationExists * OpeningParenthesisMustBeOnDeclarationLine * ClosingParenthesisMustBeOnLineOfLastParameter * ClosingParenthesisMustBeOnLineOfOpeningParenthesis * CommaMustBeOnSameLineAsPreviousParameter * ParameterListMustFollowDeclaration * ParameterMustNotSpanMultipleLines * QueryClauseMustFollowPreviousClause * QueryClausesMustBeOnSeparateLinesOrAllOnOneLine * QueryClauseMustBeginOnNewLineWhenPreviousClauseSpansMultipleLines * QueryClausesSpanningMultipleLinesMustBeginOnOwnLine * DoNotPlaceRegionsWithinElements * CodeMustNotContainEmptyStatements * CodeMustNotContainMultipleStatementsOnOneLine * BlockStatementsMustNotContainEmbeddedComments * BlockStatementsMustNotContainEmbeddedRegions * UseStringEmptyForEmptyStrings * UseBuiltInTypeAlias * UseShorthandForNullableTypes
JIRA: [REEF-1055](https://issues.apache.org/jira/browse/REEF-1055) Pull request: This closes #724 Project: http://git-wip-us.apache.org/repos/asf/reef/repo Commit: http://git-wip-us.apache.org/repos/asf/reef/commit/b73c2229 Tree: http://git-wip-us.apache.org/repos/asf/reef/tree/b73c2229 Diff: http://git-wip-us.apache.org/repos/asf/reef/diff/b73c2229 Branch: refs/heads/master Commit: b73c222958511c10e201d6f85c993580c7c6fa8c Parents: 52518d1 Author: Mariia Mykhailova <[email protected]> Authored: Fri Dec 11 16:15:21 2015 -0800 Committer: Markus Weimer <[email protected]> Committed: Tue Dec 15 16:56:08 2015 -0800 ---------------------------------------------------------------------- .../Common/DriverFolderPreparationHelper.cs | 2 +- .../Common/JavaClientLauncher.cs | 5 ++- .../Common/JobSubmissionResult.cs | 7 ++-- .../YARN/RESTClient/YarnClient.cs | 8 ++-- .../YARN/YARNREEFClient.cs | 5 ++- .../Evaluator/Utils/EvaluatorConfigurations.cs | 4 +- .../Bridge/BridgeConfigurationProvider.cs | 16 ++++---- .../Bridge/IInteropReturnInfo.cs | 4 +- .../cs/Org.Apache.REEF.Driver/Bridge/ILogger.cs | 2 +- .../Evaluator/EvaluatorRequestBuilder.cs | 2 +- lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs | 8 ++-- .../HelloHttpHandler.cs | 5 ++- .../MapperCountTest.cs | 2 +- .../InProcess/InProcessIMRUClient.cs | 3 +- .../OnREEF/Driver/ConfigurationManager.cs | 6 +-- .../OnREEF/Driver/IMRUDriver.cs | 8 ++-- .../OnREEF/ResultHandler/WriteResultHandler.cs | 2 +- .../FileSystem/Hadoop/HDFSCommandRunner.cs | 2 +- .../FileSystem/FileInputPartitionDescriptor.cs | 3 +- .../FileSystem/FileSystemInputPartition.cs | 14 +++---- .../FileSystemPartitionInputDataSet.cs | 2 +- .../BroadcastReduceDriverAndTasks/MasterTask.cs | 6 +-- .../BroadcastReduceDriverAndTasks/SlaveTask.cs | 6 +-- .../PipelinedBroadcastReduceDriver.cs | 6 +-- .../PipelinedMasterTask.cs | 6 +-- .../PipelinedSlaveTask.cs | 6 +-- .../Group/Task/Impl/OperatorTopology.cs | 2 +- .../Codec/StreamingCodecFunctionCache.cs | 16 ++++---- .../DocumentedLocalNamedParameter.cs | 4 +- .../NamedParameterConstructors.cs | 6 +-- .../ShortNameFooAB.cs | 4 +- .../SimpleConstructors.cs | 2 +- lang/cs/Org.Apache.REEF.Tang.Examples/Timer.cs | 2 +- .../TweetExample.cs | 8 ++-- .../ClassHierarchy/TestClassHierarchy.cs | 10 ++--- .../ClassHierarchy/TestParameterParser.cs | 18 ++++----- .../ClassHierarchy/TestSerilization.cs | 2 +- .../Configuration/TestConfiguration.cs | 6 +-- .../Org.Apache.REEF.Tang.Tests/Tang/TestTang.cs | 28 +++++++------- .../Utilities/TestUtilities.cs | 6 +-- .../Exceptions/BindException.cs | 2 +- .../Exceptions/ClassHierarchyException.cs | 2 +- .../Exceptions/IllegalStateException.cs | 2 +- .../Exceptions/InjectionException.cs | 2 +- .../Exceptions/NameResolutionException.cs | 2 +- .../Exceptions/ParseException.cs | 2 +- .../Formats/ConfigurationFile.cs | 6 +-- .../ClassHierarchy/AbstractNode.cs | 16 ++++---- .../ClassHierarchy/AvroClassHierarchy.cs | 10 ++--- .../AvroClassHierarchySerializer.cs | 6 +-- .../ClassHierarchy/ClassHierarchyImpl.cs | 7 ++-- .../ClassHierarchy/ClassNodeImpl.cs | 10 ++--- .../ClassHierarchy/ConstructorArgImpl.cs | 10 ++--- .../ClassHierarchy/ConstructorDefImpl.cs | 14 +++---- .../ClassHierarchy/NamedParameterNodeImpl.cs | 28 +++++++------- .../ClassHierarchy/NodeFactory.cs | 8 ++-- .../ClassHierarchy/PackageNodeImpl.cs | 4 +- .../ClassHierarchy/ParameterParser.cs | 39 ++++++++++--------- .../Configuration/ConfigurationBuilderImpl.cs | 14 +++---- .../Configuration/ConfigurationImpl.cs | 2 +- .../Configuration/CsConfigurationBuilderImpl.cs | 2 +- .../InjectionPlan/Constructor.cs | 2 +- .../InjectionPlan/InjectionPlan.cs | 4 +- .../InjectionPlan/InjectorImpl.cs | 26 ++++++------- .../Implementations/InjectionPlan/Subplan.cs | 6 ++- .../Interface/IConfiguration.cs | 4 +- .../Org.Apache.REEF.Tang/Interface/IInjector.cs | 4 +- .../Protobuf/ProtocolBufferClassHierarchy.cs | 12 +++--- .../Protobuf/ProtocolBufferInjectionPlan.cs | 2 +- .../Org.Apache.REEF.Tang/Util/AssemblyLoader.cs | 2 +- .../Org.Apache.REEF.Tang/Util/MonotonicSet.cs | 2 +- .../Util/MonotonicTreeMap.cs | 2 +- .../Util/ReflectionUtilities.cs | 19 +++++----- .../Org.Apache.REEF.Tang/Util/SetValuedKey.cs | 2 +- .../Bridge/HelloSimpleEventHandlers.cs | 2 +- .../Bridge/TestSimpleEventHandlers.cs | 2 +- .../Functional/ReefFunctionalTest.cs | 6 +-- .../Remote/Impl/DefaultRemoteManager.cs | 6 +-- .../Remote/Impl/StreamDataReader.cs | 8 ++-- .../Remote/Impl/StreamingTransportServer.cs | 2 +- .../Remote/Impl/TransportServer.cs | 2 +- lang/cs/Settings.StyleCop | 40 ++++++++++---------- 82 files changed, 298 insertions(+), 299 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Client/Common/DriverFolderPreparationHelper.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Client/Common/DriverFolderPreparationHelper.cs b/lang/cs/Org.Apache.REEF.Client/Common/DriverFolderPreparationHelper.cs index 03a63da..1ddae18 100644 --- a/lang/cs/Org.Apache.REEF.Client/Common/DriverFolderPreparationHelper.cs +++ b/lang/cs/Org.Apache.REEF.Client/Common/DriverFolderPreparationHelper.cs @@ -170,7 +170,7 @@ namespace Org.Apache.REEF.Client.Common /// </summary> /// <param name="filePath"></param> /// <returns></returns> - private static Boolean IsAssemblyToCopy(string filePath) + private static bool IsAssemblyToCopy(string filePath) { var fileName = Path.GetFileName(filePath); if (string.IsNullOrWhiteSpace(fileName)) http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Client/Common/JavaClientLauncher.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Client/Common/JavaClientLauncher.cs b/lang/cs/Org.Apache.REEF.Client/Common/JavaClientLauncher.cs index 25b6fe7..59e5251 100644 --- a/lang/cs/Org.Apache.REEF.Client/Common/JavaClientLauncher.cs +++ b/lang/cs/Org.Apache.REEF.Client/Common/JavaClientLauncher.cs @@ -64,8 +64,9 @@ namespace Org.Apache.REEF.Client.Common RedirectStandardError = true }; - Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "Launch Java with command: {0} {1}", - startInfo.FileName, startInfo.Arguments)); + var msg = string.Format(CultureInfo.CurrentCulture, "Launch Java with command: {0} {1}", + startInfo.FileName, startInfo.Arguments); + Logger.Log(Level.Info, msg); var process = Process.Start(startInfo); if (process != null) http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Client/Common/JobSubmissionResult.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Client/Common/JobSubmissionResult.cs b/lang/cs/Org.Apache.REEF.Client/Common/JobSubmissionResult.cs index 28bf877..d81637f 100644 --- a/lang/cs/Org.Apache.REEF.Client/Common/JobSubmissionResult.cs +++ b/lang/cs/Org.Apache.REEF.Client/Common/JobSubmissionResult.cs @@ -172,7 +172,7 @@ namespace Org.Apache.REEF.Client.Common return shouldRetry; } - private static Tuple<bool, string> CommandFailed(String reason) + private static Tuple<bool, string> CommandFailed(string reason) { return new Tuple<bool, string>(false, null); } @@ -208,8 +208,7 @@ namespace Org.Apache.REEF.Client.Common if (!ShouldRetry(httpRequestException)) { LOGGER.Log(Level.Error, - commandUri + " exception " + httpRequestException.Message + "\n" + - httpRequestException.StackTrace); + commandUri + " exception " + httpRequestException.Message + "\n" + httpRequestException.StackTrace); result = CommandFailed(httpRequestException.Message); LOGGER.Log(Level.Warning, "Connection failed. connectAttemptCount was " + connectAttemptCount + "."); break; @@ -301,7 +300,7 @@ namespace Org.Apache.REEF.Client.Common _driverUrl = values[TrackingUrlKey].ToString(); LOGGER.Log(Level.Info, "trackingUrl[" + _driverUrl + "]"); - if (0 == String.Compare(_driverUrl, UnAssigned)) + if (0 == string.Compare(_driverUrl, UnAssigned)) { resultKind = UrlResultKind.UrlNotAssignedYet; } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Client/YARN/RESTClient/YarnClient.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Client/YARN/RESTClient/YarnClient.cs b/lang/cs/Org.Apache.REEF.Client/YARN/RESTClient/YarnClient.cs index 030fc37..62f0c14 100644 --- a/lang/cs/Org.Apache.REEF.Client/YARN/RESTClient/YarnClient.cs +++ b/lang/cs/Org.Apache.REEF.Client/YARN/RESTClient/YarnClient.cs @@ -145,8 +145,8 @@ namespace Org.Apache.REEF.Client.Yarn.RestClient catch (Exception e) { exceptions.Add(e); - Logger.Log(Level.Verbose, string.Format( - CultureInfo.CurrentCulture, "Possibly transient error in rest call {0}", e.Message)); + Logger.Log(Level.Verbose, + string.Format(CultureInfo.CurrentCulture, "Possibly transient error in rest call {0}", e.Message)); } } @@ -169,8 +169,8 @@ namespace Org.Apache.REEF.Client.Yarn.RestClient catch (Exception e) { exceptions.Add(e); - Logger.Log(Level.Verbose, string.Format( - CultureInfo.CurrentCulture, "Possibly transient error in rest call {0}", e.Message)); + Logger.Log(Level.Verbose, + string.Format(CultureInfo.CurrentCulture, "Possibly transient error in rest call {0}", e.Message)); } } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Client/YARN/YARNREEFClient.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Client/YARN/YARNREEFClient.cs b/lang/cs/Org.Apache.REEF.Client/YARN/YARNREEFClient.cs index fbfaa87..d27101e 100644 --- a/lang/cs/Org.Apache.REEF.Client/YARN/YARNREEFClient.cs +++ b/lang/cs/Org.Apache.REEF.Client/YARN/YARNREEFClient.cs @@ -112,8 +112,9 @@ namespace Org.Apache.REEF.Client.Yarn { var application = await _yarnClient.GetApplicationAsync(appId); - Logger.Log(Level.Verbose, string.Format("application status {0}, Progress: {1}, trackingUri: {2}, Name: {3}, ApplicationId: {4}, State {5}.", - application.FinalStatus, application.Progress, application.TrackingUI, application.Name, application.Id, application.State)); + var msg = string.Format("application status {0}, Progress: {1}, trackingUri: {2}, Name: {3}, ApplicationId: {4}, State {5}.", + application.FinalStatus, application.Progress, application.TrackingUI, application.Name, application.Id, application.State); + Logger.Log(Level.Verbose, msg); return application.FinalStatus; } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Utils/EvaluatorConfigurations.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Utils/EvaluatorConfigurations.cs b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Utils/EvaluatorConfigurations.cs index 4b275da..bd8cb78 100644 --- a/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Utils/EvaluatorConfigurations.cs +++ b/lang/cs/Org.Apache.REEF.Common/Runtime/Evaluator/Utils/EvaluatorConfigurations.cs @@ -73,8 +73,8 @@ namespace Org.Apache.REEF.Common.Runtime.Evaluator.Utils IInjector evaluatorInjector = TangFactory.GetTang().NewInjector(evaluatorConfiguration); - LOGGER.Log(Level.Info, String.Format(CultureInfo.CurrentCulture, - "Evaluator Configuration is deserialized from file {0}:", configFile)); + LOGGER.Log(Level.Info, + string.Format(CultureInfo.CurrentCulture, "Evaluator Configuration is deserialized from file {0}:", configFile)); try { _taskConfiguration = evaluatorInjector.GetNamedInstance<InitialTaskConfiguration, string>(); http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Driver/Bridge/BridgeConfigurationProvider.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/BridgeConfigurationProvider.cs b/lang/cs/Org.Apache.REEF.Driver/Bridge/BridgeConfigurationProvider.cs index cae5281..96d2dd6 100644 --- a/lang/cs/Org.Apache.REEF.Driver/Bridge/BridgeConfigurationProvider.cs +++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/BridgeConfigurationProvider.cs @@ -74,10 +74,10 @@ namespace Org.Apache.REEF.Driver.Bridge if (newExists && oldExists) { - Logger.Log(Level.Warning, "Found configurations in both the legacy location (" + - legacyBridgeConfigurationPath + ") and the new location (" + - newBridgeConfigurationPath + - "). Loading only the one found in the new location."); + var msg = "Found configurations in both the legacy location (" + legacyBridgeConfigurationPath + + ") and the new location (" + newBridgeConfigurationPath + + "). Loading only the one found in the new location."; + Logger.Log(Level.Warning, msg); } if (newExists) { @@ -85,10 +85,10 @@ namespace Org.Apache.REEF.Driver.Bridge } if (oldExists) { - Logger.Log(Level.Warning, "Only found configuration in the legacy location (" + - legacyBridgeConfigurationPath + ") and not the new location (" + - newBridgeConfigurationPath + - "). Loading only the one found in the legacy location."); + var msg = "Only found configuration in the legacy location (" + legacyBridgeConfigurationPath + + ") and not the new location (" + newBridgeConfigurationPath + + "). Loading only the one found in the legacy location."; + Logger.Log(Level.Warning, msg); return legacyBridgeConfigurationPath; } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Driver/Bridge/IInteropReturnInfo.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/IInteropReturnInfo.cs b/lang/cs/Org.Apache.REEF.Driver/Bridge/IInteropReturnInfo.cs index a479158..bfcc9c3 100644 --- a/lang/cs/Org.Apache.REEF.Driver/Bridge/IInteropReturnInfo.cs +++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/IInteropReturnInfo.cs @@ -22,8 +22,8 @@ namespace Org.Apache.REEF.Driver.Bridge { public interface IInteropReturnInfo { - void AddExceptionString(String exceptionString); - Boolean HasExceptions(); + void AddExceptionString(string exceptionString); + bool HasExceptions(); void SetReturnCode(int rc); int GetReturnCode(); } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Driver/Bridge/ILogger.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Driver/Bridge/ILogger.cs b/lang/cs/Org.Apache.REEF.Driver/Bridge/ILogger.cs index 4ec822b..64e2cb5 100644 --- a/lang/cs/Org.Apache.REEF.Driver/Bridge/ILogger.cs +++ b/lang/cs/Org.Apache.REEF.Driver/Bridge/ILogger.cs @@ -32,6 +32,6 @@ namespace Org.Apache.REEF.Driver.Bridge public interface ILogger { - void Log(TraceLevel traceLevel, String message); + void Log(TraceLevel traceLevel, string message); } } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Driver/Evaluator/EvaluatorRequestBuilder.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Driver/Evaluator/EvaluatorRequestBuilder.cs b/lang/cs/Org.Apache.REEF.Driver/Evaluator/EvaluatorRequestBuilder.cs index 0f4c97c..7bb83ce 100644 --- a/lang/cs/Org.Apache.REEF.Driver/Evaluator/EvaluatorRequestBuilder.cs +++ b/lang/cs/Org.Apache.REEF.Driver/Evaluator/EvaluatorRequestBuilder.cs @@ -41,7 +41,7 @@ namespace Org.Apache.REEF.Driver.Evaluator Number = 1; VirtualCore = 1; MegaBytes = 64; - _rackName = String.Empty; + _rackName = string.Empty; _evaluatorBatchId = Guid.NewGuid().ToString("N"); } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs b/lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs index 96da694..b88d409 100644 --- a/lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs +++ b/lang/cs/Org.Apache.REEF.Evaluator/Evaluator.cs @@ -143,8 +143,8 @@ namespace Org.Apache.REEF.Evaluator try { var clrDriverConfig = new AvroConfigurationSerializer().FromFile(clrRuntimeConfigurationFile); - logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, - "Clr Driver Configuration is deserialized from file {0}:", clrRuntimeConfigurationFile)); + logger.Log(Level.Info, + string.Format(CultureInfo.CurrentCulture, "Clr Driver Configuration is deserialized from file {0}:", clrRuntimeConfigurationFile)); return clrDriverConfig; } catch (Exception e) @@ -169,8 +169,8 @@ namespace Org.Apache.REEF.Evaluator .GetClassHierarchy(new string[] { typeof(ApplicationIdentifier).Assembly.GetName().Name }); var evaluatorConfiguration = serializer.FromFile(evaluatorConfigFile, classHierarchy); - logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, - "Evaluator Configuration is deserialized from file {0}:", evaluatorConfigFile)); + logger.Log(Level.Info, + string.Format(CultureInfo.CurrentCulture, "Evaluator Configuration is deserialized from file {0}:", evaluatorConfigFile)); return evaluatorConfiguration; } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Examples.AllHandlers/HelloHttpHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Examples.AllHandlers/HelloHttpHandler.cs b/lang/cs/Org.Apache.REEF.Examples.AllHandlers/HelloHttpHandler.cs index 5f4992f..be05902 100644 --- a/lang/cs/Org.Apache.REEF.Examples.AllHandlers/HelloHttpHandler.cs +++ b/lang/cs/Org.Apache.REEF.Examples.AllHandlers/HelloHttpHandler.cs @@ -50,9 +50,10 @@ namespace Org.Apache.REEF.Examples.AllHandlers /// <param name="response"></param> public void OnHttpRequest(ReefHttpRequest request, ReefHttpResponse response) { - Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, + var msg = string.Format(CultureInfo.CurrentCulture, "HelloHttpHandler OnHttpRequest: URL: {0}, QueryString: {1}, inputStream: {2}.", - request.Url, request.Querystring, ByteUtilities.ByteArraysToString(request.InputStream))); + request.Url, request.Querystring, ByteUtilities.ByteArraysToString(request.InputStream)); + Logger.Log(Level.Info, msg); response.Status = HttpStatusCode.OK; response.OutputStream = ByteUtilities.StringToByteArrays("Byte array returned from HelloHttpHandler in CLR!!!"); http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.IMRU.Tests/MapperCountTest.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.IMRU.Tests/MapperCountTest.cs b/lang/cs/Org.Apache.REEF.IMRU.Tests/MapperCountTest.cs index dd97636..2de426c 100644 --- a/lang/cs/Org.Apache.REEF.IMRU.Tests/MapperCountTest.cs +++ b/lang/cs/Org.Apache.REEF.IMRU.Tests/MapperCountTest.cs @@ -44,7 +44,7 @@ namespace Org.Apache.REEF.IMRU.Tests .Set(InProcessIMRUConfiguration.NumberOfMappers, NumberOfMappers.ToString()) .Build()) .GetInstance<MapperCount>(); - var result = tested.Run(NumberOfMappers, "", TangFactory.GetTang().NewConfigurationBuilder().Build()); + var result = tested.Run(NumberOfMappers, string.Empty, TangFactory.GetTang().NewConfigurationBuilder().Build()); Assert.True(NumberOfMappers == result, "The result of the run should be the number of Mappers."); } } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.IMRU/InProcess/InProcessIMRUClient.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.IMRU/InProcess/InProcessIMRUClient.cs b/lang/cs/Org.Apache.REEF.IMRU/InProcess/InProcessIMRUClient.cs index 5ad89f5..24c8325 100644 --- a/lang/cs/Org.Apache.REEF.IMRU/InProcess/InProcessIMRUClient.cs +++ b/lang/cs/Org.Apache.REEF.IMRU/InProcess/InProcessIMRUClient.cs @@ -92,8 +92,7 @@ namespace Org.Apache.REEF.IMRU.InProcess (ISet<IPerMapperConfigGenerator>)injector.GetNamedInstance(typeof(PerMapConfigGeneratorSet)); injector.BindVolatileInstance(GenericType<MapFunctions<TMapInput, TMapOutput>>.Class, - MakeMapFunctions<TMapInput, TMapOutput>(jobDefinition.MapFunctionConfiguration, - jobDefinition.PartitionedDatasetConfiguration, perMapConfigGenerators)); + MakeMapFunctions<TMapInput, TMapOutput>(jobDefinition.MapFunctionConfiguration, jobDefinition.PartitionedDatasetConfiguration, perMapConfigGenerators)); var runner = injector.GetInstance<IMRURunner<TMapInput, TMapOutput, TResult>>(); return runner.Run(); http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.IMRU/OnREEF/Driver/ConfigurationManager.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.IMRU/OnREEF/Driver/ConfigurationManager.cs b/lang/cs/Org.Apache.REEF.IMRU/OnREEF/Driver/ConfigurationManager.cs index 4045fc7..b9d0542 100644 --- a/lang/cs/Org.Apache.REEF.IMRU/OnREEF/Driver/ConfigurationManager.cs +++ b/lang/cs/Org.Apache.REEF.IMRU/OnREEF/Driver/ConfigurationManager.cs @@ -49,10 +49,8 @@ namespace Org.Apache.REEF.IMRU.OnREEF.Driver [Parameter(typeof(SerializedUpdateConfiguration))] string updateConfig, [Parameter(typeof(SerializedMapInputCodecConfiguration))] string mapInputCodecConfig, [Parameter(typeof(SerializedUpdateFunctionCodecsConfiguration))] string updateFunctionCodecsConfig, - [Parameter(typeof(SerializedMapOutputPipelineDataConverterConfiguration))] string - mapOutputPipelineDataConverterConfiguration, - [Parameter(typeof(SerializedMapInputPipelineDataConverterConfiguration))] string - mapInputPipelineDataConverterConfiguration, + [Parameter(typeof(SerializedMapOutputPipelineDataConverterConfiguration))] string mapOutputPipelineDataConverterConfiguration, + [Parameter(typeof(SerializedMapInputPipelineDataConverterConfiguration))] string mapInputPipelineDataConverterConfiguration, [Parameter(typeof(SerializedResultHandlerConfiguration))] string resultHandlerConfiguration) { try http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.IMRU/OnREEF/Driver/IMRUDriver.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.IMRU/OnREEF/Driver/IMRUDriver.cs b/lang/cs/Org.Apache.REEF.IMRU/OnREEF/Driver/IMRUDriver.cs index f4478c4..9197703 100644 --- a/lang/cs/Org.Apache.REEF.IMRU/OnREEF/Driver/IMRUDriver.cs +++ b/lang/cs/Org.Apache.REEF.IMRU/OnREEF/Driver/IMRUDriver.cs @@ -118,9 +118,9 @@ namespace Org.Apache.REEF.IMRU.OnREEF.Driver new ServiceAndContextConfigurationProvider<TMapInput, TMapOutput>(dataSet.Count + 1, groupCommDriver, _configurationManager, _partitionDescriptorStack); - Logger.Log(Level.Info, - string.Format("map task memory:{0}, update task memory:{1}, map task cores:{2}, update task cores:{3}", - _memoryPerMapper, _memoryForUpdateTask, _coresPerMapper, _coresForUpdateTask)); + var msg = string.Format("map task memory:{0}, update task memory:{1}, map task cores:{2}, update task cores:{3}", + _memoryPerMapper, _memoryForUpdateTask, _coresPerMapper, _coresForUpdateTask); + Logger.Log(Level.Info, msg); } /// <summary> @@ -251,7 +251,7 @@ namespace Org.Apache.REEF.IMRU.OnREEF.Driver foreach (var task in _completedTasks) { - Logger.Log(Level.Verbose, String.Format("Disposing task: {0}", task.Id)); + Logger.Log(Level.Verbose, string.Format("Disposing task: {0}", task.Id)); task.ActiveContext.Dispose(); } } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.IMRU/OnREEF/ResultHandler/WriteResultHandler.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.IMRU/OnREEF/ResultHandler/WriteResultHandler.cs b/lang/cs/Org.Apache.REEF.IMRU/OnREEF/ResultHandler/WriteResultHandler.cs index e588480..5c48bcd 100644 --- a/lang/cs/Org.Apache.REEF.IMRU/OnREEF/ResultHandler/WriteResultHandler.cs +++ b/lang/cs/Org.Apache.REEF.IMRU/OnREEF/ResultHandler/WriteResultHandler.cs @@ -96,7 +96,7 @@ namespace Org.Apache.REEF.IMRU.OnREEF.ResultHandler { string localFileFolder = Path.GetTempPath() + "-partition-" + Guid.NewGuid().ToString("N").Substring(0, 8); Directory.CreateDirectory(localFileFolder); - var localFilePath = String.Format("{0}\\{1}", localFileFolder, Guid.NewGuid().ToString("N").Substring(0, 8)); + var localFilePath = string.Format("{0}\\{1}", localFileFolder, Guid.NewGuid().ToString("N").Substring(0, 8)); if (File.Exists(localFilePath)) { http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HDFSCommandRunner.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HDFSCommandRunner.cs b/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HDFSCommandRunner.cs index f0d1f97..3939218 100644 --- a/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HDFSCommandRunner.cs +++ b/lang/cs/Org.Apache.REEF.IO/FileSystem/Hadoop/HDFSCommandRunner.cs @@ -120,7 +120,7 @@ namespace Org.Apache.REEF.IO.FileSystem.Hadoop }; for (var attemptNumber = 0; attemptNumber < _numberOfRetries; ++attemptNumber) { - var processName = String.Format("HDFS_Attempt_{0}_of_{1}", attemptNumber, _numberOfRetries); + var processName = string.Format("HDFS_Attempt_{0}_of_{1}", attemptNumber, _numberOfRetries); var result = RunAttempt(processStartInfo, _timeOutInMilliSeconds, processName); if (null != result) { http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileInputPartitionDescriptor.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileInputPartitionDescriptor.cs b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileInputPartitionDescriptor.cs index 7e170c9..d9bd8cd 100644 --- a/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileInputPartitionDescriptor.cs +++ b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileInputPartitionDescriptor.cs @@ -58,8 +58,7 @@ namespace Org.Apache.REEF.IO.PartitionedData.FileSystem foreach (string p in _filePaths) { - builder = builder.BindSetEntry<FilePathsInInputPartition, string> - (GenericType<FilePathsInInputPartition>.Class, p); + builder = builder.BindSetEntry<FilePathsInInputPartition, string>(GenericType<FilePathsInInputPartition>.Class, p); } return Configurations.Merge(builder.Build(), _filePartitionDeserializerConfig); http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemInputPartition.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemInputPartition.cs b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemInputPartition.cs index f3d9764..76cb128 100644 --- a/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemInputPartition.cs +++ b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemInputPartition.cs @@ -95,8 +95,7 @@ namespace Org.Apache.REEF.IO.PartitionedData.FileSystem foreach (var sourceFilePath in _filePaths) { Uri sourceUri = _fileSystem.CreateUriForPath(sourceFilePath); - Logger.Log(Level.Info, string.Format - (CultureInfo.CurrentCulture, "sourceUri {0}: ", sourceUri)); + Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "sourceUri {0}: ", sourceUri)); if (!_fileSystem.Exists(sourceUri)) { throw new FileNotFoundException(string.Format(CultureInfo.CurrentCulture, @@ -104,8 +103,7 @@ namespace Org.Apache.REEF.IO.PartitionedData.FileSystem } var localFilePath = _localFileFolder + "\\" + Guid.NewGuid().ToString("N").Substring(0, 8); - Logger.Log(Level.Info, string.Format - (CultureInfo.CurrentCulture, "localFilePath {0}: ", localFilePath)); + Logger.Log(Level.Info, string.Format(CultureInfo.CurrentCulture, "localFilePath {0}: ", localFilePath)); if (File.Exists(localFilePath)) { File.Delete(localFilePath); @@ -115,13 +113,13 @@ namespace Org.Apache.REEF.IO.PartitionedData.FileSystem _fileSystem.CopyToLocal(sourceUri, localFilePath); if (File.Exists(localFilePath)) { - Logger.Log(Level.Info, string.Format - (CultureInfo.CurrentCulture, "File {0} is Copied to local {1}.", sourceUri, localFilePath)); + Logger.Log(Level.Info, + string.Format(CultureInfo.CurrentCulture, "File {0} is Copied to local {1}.", sourceUri, localFilePath)); } else { - string msg = string.Format - (CultureInfo.CurrentCulture, "The IFilesystem completed the copy of `{0}` to `{1}`. But the file `{1}` does not exist.", sourceUri, localFilePath); + string msg = string.Format(CultureInfo.CurrentCulture, + "The IFilesystem completed the copy of `{0}` to `{1}`. But the file `{1}` does not exist.", sourceUri, localFilePath); Exceptions.Throw(new FileLoadException(msg), msg, Logger); } } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartitionInputDataSet.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartitionInputDataSet.cs b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartitionInputDataSet.cs index 1bfc4ac..59acc43 100644 --- a/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartitionInputDataSet.cs +++ b/lang/cs/Org.Apache.REEF.IO/PartitionedData/FileSystem/FileSystemPartitionInputDataSet.cs @@ -126,7 +126,7 @@ namespace Org.Apache.REEF.IO.PartitionedData.FileSystem /// <returns></returns> private static string FormId(ISet<string> filePaths) { - string id = ""; + string id = string.Empty; try { if (filePaths != null && filePaths.Count > 0) http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/BroadcastReduceDriverAndTasks/MasterTask.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/BroadcastReduceDriverAndTasks/MasterTask.cs b/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/BroadcastReduceDriverAndTasks/MasterTask.cs index 7ec6609..cfcd9dd 100644 --- a/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/BroadcastReduceDriverAndTasks/MasterTask.cs +++ b/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/BroadcastReduceDriverAndTasks/MasterTask.cs @@ -91,10 +91,10 @@ namespace Org.Apache.REEF.Network.Examples.GroupCommunication.BroadcastReduceDri if (i >= 2) { - Logger.Log(Level.Info, - string.Format("Average time (milliseconds) taken for broadcast: {0} and reduce: {1}", + var msg = string.Format("Average time (milliseconds) taken for broadcast: {0} and reduce: {1}", broadcastTime.ElapsedMilliseconds / ((double)(i - 1)), - reduceTime.ElapsedMilliseconds / ((double)(i - 1)))); + reduceTime.ElapsedMilliseconds / ((double)(i - 1))); + Logger.Log(Level.Info, msg); } } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/BroadcastReduceDriverAndTasks/SlaveTask.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/BroadcastReduceDriverAndTasks/SlaveTask.cs b/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/BroadcastReduceDriverAndTasks/SlaveTask.cs index a0d225c..798fa11 100644 --- a/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/BroadcastReduceDriverAndTasks/SlaveTask.cs +++ b/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/BroadcastReduceDriverAndTasks/SlaveTask.cs @@ -76,10 +76,10 @@ namespace Org.Apache.REEF.Network.Examples.GroupCommunication.BroadcastReduceDri if (i >= 1) { - Logger.Log(Level.Info, - string.Format("Average time (milliseconds) taken for broadcast: {0} and reduce: {1}", + var msg = string.Format("Average time (milliseconds) taken for broadcast: {0} and reduce: {1}", broadcastTime.ElapsedMilliseconds / ((double)i), - reduceTime.ElapsedMilliseconds / ((double)i))); + reduceTime.ElapsedMilliseconds / ((double)i)); + Logger.Log(Level.Info, msg); } } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedBroadcastReduceDriver.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedBroadcastReduceDriver.cs b/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedBroadcastReduceDriver.cs index 632425b..afe4335 100644 --- a/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedBroadcastReduceDriver.cs +++ b/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedBroadcastReduceDriver.cs @@ -269,20 +269,20 @@ namespace Org.Apache.REEF.Network.Examples.GroupCommunication.PipelineBroadcastR public byte[] Encode(int[] obj) { - var result = new byte[sizeof(Int32) * obj.Length]; + var result = new byte[sizeof(int) * obj.Length]; Buffer.BlockCopy(obj, 0, result, 0, result.Length); return result; } public int[] Decode(byte[] data) { - if (data.Length % sizeof(Int32) != 0) + if (data.Length % sizeof(int) != 0) { throw new Exception( "error inside integer array decoder, byte array length not a multiple of integer size"); } - var result = new int[data.Length / sizeof(Int32)]; + var result = new int[data.Length / sizeof(int)]; Buffer.BlockCopy(data, 0, result, 0, data.Length); return result; } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedMasterTask.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedMasterTask.cs b/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedMasterTask.cs index a4a7780..62f65ea 100644 --- a/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedMasterTask.cs +++ b/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedMasterTask.cs @@ -102,10 +102,10 @@ namespace Org.Apache.REEF.Network.Examples.GroupCommunication.PipelineBroadcastR if (i >= 2) { - Logger.Log(Level.Info, - string.Format("Average time (milliseconds) taken for broadcast: {0} and reduce: {1}", + var msg = string.Format("Average time (milliseconds) taken for broadcast: {0} and reduce: {1}", broadcastTime.ElapsedMilliseconds / ((double)(i - 1)), - reduceTime.ElapsedMilliseconds / ((double)(i - 1)))); + reduceTime.ElapsedMilliseconds / ((double)(i - 1))); + Logger.Log(Level.Info, msg); } } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedSlaveTask.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedSlaveTask.cs b/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedSlaveTask.cs index 975a131..b6467e8 100644 --- a/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedSlaveTask.cs +++ b/lang/cs/Org.Apache.REEF.Network.Examples/GroupCommunication/PipelineBroadcastReduceDriverAndTasks/PipelinedSlaveTask.cs @@ -95,10 +95,10 @@ namespace Org.Apache.REEF.Network.Examples.GroupCommunication.PipelineBroadcastR if (i >= 1) { - Logger.Log(Level.Info, - string.Format("Average time (milliseconds) taken for broadcast: {0} and reduce: {1}", + var msg = string.Format("Average time (milliseconds) taken for broadcast: {0} and reduce: {1}", broadcastTime.ElapsedMilliseconds / ((double)i), - reduceTime.ElapsedMilliseconds / ((double)i))); + reduceTime.ElapsedMilliseconds / ((double)i)); + Logger.Log(Level.Info, msg); } } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/OperatorTopology.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/OperatorTopology.cs b/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/OperatorTopology.cs index b3a33f8..669ad41 100644 --- a/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/OperatorTopology.cs +++ b/lang/cs/Org.Apache.REEF.Network/Group/Task/Impl/OperatorTopology.cs @@ -59,7 +59,7 @@ namespace Org.Apache.REEF.Network.Group.Task.Impl private readonly INameClient _nameClient; private readonly Sender _sender; private readonly BlockingCollection<NodeStruct<T>> _nodesWithData; - private readonly Object _thisLock = new Object(); + private readonly object _thisLock = new object(); /// <summary> /// Creates a new OperatorTopology object. http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/StreamingCodecFunctionCache.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/StreamingCodecFunctionCache.cs b/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/StreamingCodecFunctionCache.cs index 5866013..05676ad 100644 --- a/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/StreamingCodecFunctionCache.cs +++ b/lang/cs/Org.Apache.REEF.Network/NetworkService/Codec/StreamingCodecFunctionCache.cs @@ -148,8 +148,8 @@ namespace Org.Apache.REEF.Network.NetworkService.Codec var codec = _injector.GetInstance(codecType); MethodInfo readMethod = codec.GetType().GetMethod("Read"); - _readFuncCache[messageType] = (Func<IDataReader, T>)Delegate.CreateDelegate - (typeof(Func<IDataReader, T>), codec, readMethod); + _readFuncCache[messageType] = + (Func<IDataReader, T>)Delegate.CreateDelegate(typeof(Func<IDataReader, T>), codec, readMethod); MethodInfo readAsyncMethod = codec.GetType().GetMethod("ReadAsync"); MethodInfo genericHelper = GetType() @@ -177,8 +177,8 @@ namespace Org.Apache.REEF.Network.NetworkService.Codec private Action<T, IDataWriter> WriteHelperFunc<T1>(MethodInfo method, object codec) where T1 : class { - Action<T1, IDataWriter> func = (Action<T1, IDataWriter>)Delegate.CreateDelegate - (typeof(Action<T1, IDataWriter>), codec, method); + Action<T1, IDataWriter> func = + (Action<T1, IDataWriter>)Delegate.CreateDelegate(typeof(Action<T1, IDataWriter>), codec, method); Action<T, IDataWriter> ret = (obj, writer) => func(obj as T1, writer); return ret; @@ -188,8 +188,8 @@ namespace Org.Apache.REEF.Network.NetworkService.Codec where T1 : class { Func<T1, IDataWriter, CancellationToken, Task> func = - (Func<T1, IDataWriter, CancellationToken, Task>)Delegate.CreateDelegate - (typeof(Func<T1, IDataWriter, CancellationToken, Task>), codec, method); + (Func<T1, IDataWriter, CancellationToken, Task>) + Delegate.CreateDelegate(typeof(Func<T1, IDataWriter, CancellationToken, Task>), codec, method); Func<T, IDataWriter, CancellationToken, Task> ret = (obj, writer, token) => func(obj as T1, writer, token); return ret; @@ -199,8 +199,8 @@ namespace Org.Apache.REEF.Network.NetworkService.Codec where T1 : class { Func<IDataReader, CancellationToken, Task<T1>> func = - (Func<IDataReader, CancellationToken, Task<T1>>)Delegate.CreateDelegate - (typeof(Func<IDataReader, CancellationToken, Task<T1>>), codec, method); + (Func<IDataReader, CancellationToken, Task<T1>>) + Delegate.CreateDelegate(typeof(Func<IDataReader, CancellationToken, Task<T1>>), codec, method); Func<IDataReader, CancellationToken, T1> func1 = (writer, token) => func(writer, token).Result; Func<IDataReader, CancellationToken, T> func2 = (writer, token) => ((T)(object)func1(writer, token)); http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Tang.Examples/DocumentedLocalNamedParameter.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Examples/DocumentedLocalNamedParameter.cs b/lang/cs/Org.Apache.REEF.Tang.Examples/DocumentedLocalNamedParameter.cs index 0b3b820..acfe8de 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Examples/DocumentedLocalNamedParameter.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Examples/DocumentedLocalNamedParameter.cs @@ -26,12 +26,12 @@ namespace Org.Apache.REEF.Tang.Examples { readonly string value; [NamedParameter(Documentation = "doc stuff", ShortName = "DocFoo", DefaultValue = "some value")] - public sealed class Foo : Name<String> + public sealed class Foo : Name<string> { } [Inject] - public DocumentedLocalNamedParameter([Parameter(typeof(Foo))] String s) + public DocumentedLocalNamedParameter([Parameter(typeof(Foo))] string s) { value = s; } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Tang.Examples/NamedParameterConstructors.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Examples/NamedParameterConstructors.cs b/lang/cs/Org.Apache.REEF.Tang.Examples/NamedParameterConstructors.cs index ef2955c..3f3355a 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Examples/NamedParameterConstructors.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Examples/NamedParameterConstructors.cs @@ -25,12 +25,12 @@ namespace Org.Apache.REEF.Tang.Examples public class NamedParameterConstructors { [NamedParameter] - public class X : Name<String> + public class X : Name<string> { - }; + } [Inject] - public NamedParameterConstructors(String x, [Parameter(typeof(X))] String y) + public NamedParameterConstructors(string x, [Parameter(typeof(X))] string y) { } } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Tang.Examples/ShortNameFooAB.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Examples/ShortNameFooAB.cs b/lang/cs/Org.Apache.REEF.Tang.Examples/ShortNameFooAB.cs index 4214111..7049648 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Examples/ShortNameFooAB.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Examples/ShortNameFooAB.cs @@ -23,13 +23,13 @@ using Org.Apache.REEF.Tang.Annotations; namespace Org.Apache.REEF.Tang.Examples { [NamedParameter(ShortName = "fooA")] - public class ShortNameFooA : Name<String> + public class ShortNameFooA : Name<string> { } // when same short name is used, exception would throw when building the class hierarchy [NamedParameter(ShortName = "fooB")] - public class ShortNameFooB : Name<Int32> + public class ShortNameFooB : Name<int> { } } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Tang.Examples/SimpleConstructors.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Examples/SimpleConstructors.cs b/lang/cs/Org.Apache.REEF.Tang.Examples/SimpleConstructors.cs index 50efd96..62a3e11 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Examples/SimpleConstructors.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Examples/SimpleConstructors.cs @@ -35,7 +35,7 @@ namespace Org.Apache.REEF.Tang.Examples } [Inject] - public SimpleConstructors(int x, String y) + public SimpleConstructors(int x, string y) { } } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Tang.Examples/Timer.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Examples/Timer.cs b/lang/cs/Org.Apache.REEF.Tang.Examples/Timer.cs index 3b12608..ad316df 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Examples/Timer.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Examples/Timer.cs @@ -26,7 +26,7 @@ namespace Org.Apache.REEF.Tang.Examples public class Timer { [NamedParameter("Number of seconds to sleep", "sec", "10")] - public class Seconds : Name<Int32> + public class Seconds : Name<int> { } private readonly int seconds; http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Tang.Examples/TweetExample.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Examples/TweetExample.cs b/lang/cs/Org.Apache.REEF.Tang.Examples/TweetExample.cs index ff1b066..b37d069 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Examples/TweetExample.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Examples/TweetExample.cs @@ -24,12 +24,12 @@ namespace Org.Apache.REEF.Tang.Examples { public interface ISMS { - void SendSMS(String msg, long phoneNumber); + void SendSMS(string msg, long phoneNumber); } public interface ITweetFactory { - String GetTweet(); + string GetTweet(); } public class MockTweetFactory : ITweetFactory @@ -39,7 +39,7 @@ namespace Org.Apache.REEF.Tang.Examples { } - public String GetTweet() + public string GetTweet() { return "@tw #bbq bbqftw!!! gopher://vuwed.wefd/bbqftw!"; } @@ -52,7 +52,7 @@ namespace Org.Apache.REEF.Tang.Examples { } - public void SendSMS(String msg, long phoneNumber) + public void SendSMS(string msg, long phoneNumber) { if (phoneNumber != 8675309) { http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs index 593e736..e525cd3 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestClassHierarchy.cs @@ -61,7 +61,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy } Assert.Null(n); - Assert.NotNull(ns.GetNode(typeof(System.String).AssemblyQualifiedName)); + Assert.NotNull(ns.GetNode(typeof(string).AssemblyQualifiedName)); string msg = null; try @@ -94,7 +94,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy } Assert.Null(n); - Assert.NotNull(ns.GetNode(typeof(System.Int32).AssemblyQualifiedName)); + Assert.NotNull(ns.GetNode(typeof(int).AssemblyQualifiedName)); string msg = null; try @@ -556,7 +556,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy class NamedParameterTypeMismatch { [NamedParameter(Documentation = "doc.stuff", DefaultValue = "1")] - class Foo : Name<Int32> + class Foo : Name<int> { } @@ -634,13 +634,13 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy } [NamedParameter(ShortName = "foo")] - public class ShortNameFooA : Name<String> + public class ShortNameFooA : Name<string> { } // when same short name is used, exception would throw when building the class hierarchy [NamedParameter(ShortName = "foo")] - public class ShortNameFooB : Name<Int32> + public class ShortNameFooB : Name<int> { } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs index 6ece3b3..fe976b0 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestParameterParser.cs @@ -33,14 +33,14 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy public void ParseIntTest() { var parser = new ParameterParser(); - Int32 o = (Int32)parser.Parse(typeof(Int32), "4"); + int o = (int)parser.Parse(typeof(int), "4"); } [Fact] public void ParseBoolTest() { var parser = new ParameterParser(); - Boolean o = (Boolean)parser.Parse(typeof(Boolean), "false"); + bool o = (bool)parser.Parse(typeof(bool), "false"); } [Fact] @@ -61,35 +61,35 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy public void ParseDoubleTest() { var parser = new ParameterParser(); - Double o = (Double)parser.Parse(typeof(double), "12.6"); + double o = (double)parser.Parse(typeof(double), "12.6"); } [Fact] public void ParseCharTest() { var parser = new ParameterParser(); - Char o = (Char)parser.Parse(typeof(char), "c"); + char o = (char)parser.Parse(typeof(char), "c"); } [Fact] public void ParseByteTest() { var parser = new ParameterParser(); - Byte o = (Byte)parser.Parse(typeof(byte), "8"); + byte o = (byte)parser.Parse(typeof(byte), "8"); } [Fact] public void ParseShortTest() { var parser = new ParameterParser(); - Int16 o = (Int16)parser.Parse(typeof(short), "8"); + short o = (short)parser.Parse(typeof(short), "8"); } [Fact] public void ParseFloatTest() { var parser = new ParameterParser(); - Single o = (Single)parser.Parse(typeof(float), "8.567"); + float o = (float)parser.Parse(typeof(float), "8.567"); } [Fact] @@ -226,7 +226,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy { private readonly Bar bar; [Inject] - public BarParser(String s) + public BarParser(string s) { this.bar = new Bar(s); } @@ -282,7 +282,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy { readonly ParseableType instance; [Inject] - public TypeParser(String s) + public TypeParser(string s) { if (s.Equals("a")) { http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestSerilization.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestSerilization.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestSerilization.cs index 02aed35..b6b0e51 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestSerilization.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/ClassHierarchy/TestSerilization.cs @@ -172,7 +172,7 @@ namespace Org.Apache.REEF.Tang.Tests.ClassHierarchy Type timerType = typeof(Timer); ITang tang = TangFactory.GetTang(); ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(new string[] { FileNames.Examples }); - cb.BindNamedParameter<Timer.Seconds, Int32>(GenericType<Timer.Seconds>.Class, "2"); + cb.BindNamedParameter<Timer.Seconds, int>(GenericType<Timer.Seconds>.Class, "2"); IConfiguration conf = cb.Build(); IInjector injector = tang.NewInjector(conf); Org.Apache.REEF.Tang.Implementations.InjectionPlan.InjectionPlan ip = injector.GetInjectionPlan(timerType); http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs index a101bbc..882aba2 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Configuration/TestConfiguration.cs @@ -54,7 +54,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration serializer.ToFile(conf1, "task.config"); ICsConfigurationBuilder cb2 = tang.NewConfigurationBuilder(); - cb2.BindNamedParameter<Timer.Seconds, Int32>(GenericType<Timer.Seconds>.Class, "2"); + cb2.BindNamedParameter<Timer.Seconds, int>(GenericType<Timer.Seconds>.Class, "2"); IConfiguration conf2 = cb2.Build(); serializer.ToFile(conf2, "timer.config"); @@ -354,7 +354,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration Type timerType = typeof(Timer); ITang tang = TangFactory.GetTang(); ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(new string[] { FileNames.Examples }); - cb.BindNamedParameter<Timer.Seconds, Int32>(GenericType<Timer.Seconds>.Class, "2"); + cb.BindNamedParameter<Timer.Seconds, int>(GenericType<Timer.Seconds>.Class, "2"); IConfiguration conf = cb.Build(); ConfigurationFile.WriteConfigurationFile(conf, "timerConf.txt"); @@ -406,7 +406,7 @@ namespace Org.Apache.REEF.Tang.Tests.Configuration ITang tang = TangFactory.GetTang(); IConfiguration conf = tang.NewConfigurationBuilder(classHierarchyImpl) - .BindNamedParameter<Timer.Seconds, Int32>(GenericType<Timer.Seconds>.Class, "1") + .BindNamedParameter<Timer.Seconds, int>(GenericType<Timer.Seconds>.Class, "1") .Build(); ConfigurationFile.WriteConfigurationFile(conf, "timerConfH.txt"); http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestTang.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestTang.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestTang.cs index f0bb98e..8c99ac2 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestTang.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Tang/TestTang.cs @@ -106,8 +106,8 @@ namespace Org.Apache.REEF.Tang.Tests.Tang public void TestRepeatedOKArgs() { ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(); - cb.BindNamedParameter<RepeatedNamedArgs.A, Int32>(GenericType<RepeatedNamedArgs.A>.Class, "1"); - cb.BindNamedParameter<RepeatedNamedArgs.B, Int32>(GenericType<RepeatedNamedArgs.B>.Class, "2"); + cb.BindNamedParameter<RepeatedNamedArgs.A, int>(GenericType<RepeatedNamedArgs.A>.Class, "1"); + cb.BindNamedParameter<RepeatedNamedArgs.B, int>(GenericType<RepeatedNamedArgs.B>.Class, "2"); IInjector injector = tang.NewInjector(cb.Build()); injector.GetInstance(typeof(RepeatedNamedArgs)); @@ -288,14 +288,14 @@ namespace Org.Apache.REEF.Tang.Tests.Tang public void testThreeConstructors() { ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(); - cb.BindNamedParameter<ThreeConstructors.TCInt, Int32>(GenericType<ThreeConstructors.TCInt>.Class, "1"); + cb.BindNamedParameter<ThreeConstructors.TCInt, int>(GenericType<ThreeConstructors.TCInt>.Class, "1"); cb.BindNamedParameter<ThreeConstructors.TCString, string>(GenericType<ThreeConstructors.TCString>.Class, "s"); ThreeConstructors tc = tang.NewInjector(cb.Build()).GetInstance<ThreeConstructors>(); Assert.AreEqual(1, tc.i); Assert.AreEqual("s", tc.s); cb = tang.NewConfigurationBuilder(); - cb.BindNamedParameter<ThreeConstructors.TCInt, Int32>(GenericType<ThreeConstructors.TCInt>.Class, "1"); + cb.BindNamedParameter<ThreeConstructors.TCInt, int>(GenericType<ThreeConstructors.TCInt>.Class, "1"); tc = tang.NewInjector(cb.Build()).GetInstance<ThreeConstructors>(); Assert.AreEqual(1, tc.i); Assert.AreEqual("default", tc.s); @@ -347,7 +347,7 @@ namespace Org.Apache.REEF.Tang.Tests.Tang try { ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(); - cb.BindNamedParameter<TwoConstructors.TCInt, Int32>(GenericType<TwoConstructors.TCInt>.Class, "1"); + cb.BindNamedParameter<TwoConstructors.TCInt, int>(GenericType<TwoConstructors.TCInt>.Class, "1"); cb.BindNamedParameter<ThreeConstructors.TCString, string>(GenericType<ThreeConstructors.TCString>.Class, "s"); tang.NewInjector(cb.Build()).GetInstance<TwoConstructors>(); msg = @"Cannot inject Org.Apache.REEF.Tang.Tests.Tang.TwoConstructors, Org.Apache.REEF.Tang.Test, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null " + @@ -552,7 +552,7 @@ namespace Org.Apache.REEF.Tang.Tests.Tang { ICsConfigurationBuilder cb = tang.NewConfigurationBuilder(EmptyStringAsDefaultParamConf.ConfigurationModule.Build()); var value = tang.NewInjector(cb.Build()).GetNamedInstance<EmptyStringAsDefaultParam, string>(); - Assert.IsNotNull(value.Equals("")); + Assert.IsNotNull(value.Equals(string.Empty)); } } @@ -610,12 +610,12 @@ namespace Org.Apache.REEF.Tang.Tests.Tang public class RepeatedNamedArgs { [NamedParameter] - public class A : Name<Int32> + public class A : Name<int> { } [NamedParameter] - public class B : Name<Int32> + public class B : Name<int> { } @@ -663,7 +663,7 @@ namespace Org.Apache.REEF.Tang.Tests.Tang } [NamedParameter(Documentation = "woo", ShortName = "woo", DefaultValue = "42")] - internal class Param : Name<Int32> + internal class Param : Name<int> { } @@ -711,7 +711,7 @@ namespace Org.Apache.REEF.Tang.Tests.Tang public string b; [Inject] - private TwoNamedStringArgs([Parameter(typeof(A))] string a, [Parameter(typeof(B))] String b) + private TwoNamedStringArgs([Parameter(typeof(A))] string a, [Parameter(typeof(B))] string b) { this.a = a; this.b = b; @@ -875,7 +875,7 @@ namespace Org.Apache.REEF.Tang.Tests.Tang public float f; [NamedParameter] - public class TCInt : Name<Int32> + public class TCInt : Name<int> { } @@ -922,7 +922,7 @@ namespace Org.Apache.REEF.Tang.Tests.Tang public string s; [NamedParameter] - public class TCInt : Name<Int32> + public class TCInt : Name<int> { } @@ -963,7 +963,7 @@ namespace Org.Apache.REEF.Tang.Tests.Tang } [Inject] - public SingletonMultiConst([Parameter(typeof(A))] String a) + public SingletonMultiConst([Parameter(typeof(A))] string a) { } @@ -1113,7 +1113,7 @@ namespace Org.Apache.REEF.Tang.Tests.Tang { } - internal class Foo : Name<String> + internal class Foo : Name<string> { } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/TestUtilities.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/TestUtilities.cs b/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/TestUtilities.cs index 3ed12b9..0b72c63 100644 --- a/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/TestUtilities.cs +++ b/lang/cs/Org.Apache.REEF.Tang.Tests/Utilities/TestUtilities.cs @@ -59,12 +59,12 @@ namespace Org.Apache.REEF.Tang.Tests.Utilities public void TestGetInterfaceTargetForTypeInheritFromGeneric() { Type result = ReflectionUtilities.GetInterfaceTarget(typeof(IExternalConstructor<>), typeof(Foo)); - Assert.Equal(result, typeof(Int32)); + Assert.Equal(result, typeof(int)); } - class Foo : IExternalConstructor<Int32> + class Foo : IExternalConstructor<int> { - public Int32 NewInstance() + public int NewInstance() { return 3; } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/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 70f1742..be1a1e1 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/BindException.cs @@ -24,7 +24,7 @@ namespace Org.Apache.REEF.Tang.Exceptions public class BindException : SystemException { // private static readonly long serialVersionUID = 1L; - public BindException(String message) + public BindException(string message) : base(message) { } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/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 091e326..1be638c 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/ClassHierarchyException.cs @@ -23,7 +23,7 @@ namespace Org.Apache.REEF.Tang.Exceptions { public class ClassHierarchyException : SystemException { - public ClassHierarchyException(String msg) : base(msg) + public ClassHierarchyException(string msg) : base(msg) { } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/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 1757b04..74712af 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/IllegalStateException.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/IllegalStateException.cs @@ -28,7 +28,7 @@ namespace Org.Apache.REEF.Tang.Exceptions { } - public IllegalStateException(String msg) + public IllegalStateException(string msg) : base(msg) { } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/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 a5f31f6..ee5b77e 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/InjectionException.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/InjectionException.cs @@ -23,7 +23,7 @@ namespace Org.Apache.REEF.Tang.Exceptions { public class InjectionException : Exception { - public InjectionException(String msg) + public InjectionException(string msg) : base(msg) { } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/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 2bdbedc..fc066d0 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/NameResolutionException.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/NameResolutionException.cs @@ -24,7 +24,7 @@ namespace Org.Apache.REEF.Tang.Exceptions public class NameResolutionException : BindException { // private static readonly long serialVersionUID = 1L; - public NameResolutionException(String name, String longestPrefix) : + public 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)) { http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/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 45a4ae1..e2bfcf6 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Exceptions/ParseException.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Exceptions/ParseException.cs @@ -24,7 +24,7 @@ namespace Org.Apache.REEF.Tang.Exceptions public class ParseException : BindException { // private static readonly long serialVersionUID = 1L; - public ParseException(String message) + public ParseException(string message) : base(message) { } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/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 9840718..12194fe 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Formats/ConfigurationFile.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Formats/ConfigurationFile.cs @@ -49,7 +49,7 @@ namespace Org.Apache.REEF.Tang.Formats } } - public static String ToConfigurationString(IConfiguration c) + public static string ToConfigurationString(IConfiguration c) { StringBuilder sb = new StringBuilder(); foreach (string s in ToConfigurationStringList(c)) @@ -95,7 +95,7 @@ namespace Org.Apache.REEF.Tang.Formats } } - public static HashSet<String> ToConfigurationStringList(IConfiguration c) + public static HashSet<string> ToConfigurationStringList(IConfiguration c) { ConfigurationImpl conf = (ConfigurationImpl)c; HashSet<string> l = new HashSet<string>(); @@ -297,7 +297,7 @@ namespace Org.Apache.REEF.Tang.Formats // return in.ReplaceAll("\\\\", "\\\\\\\\").replaceAll("\"", "\\\\\\\""); } - public static StringBuilder Join(StringBuilder sb, String sep, IConstructorArg[] types) + public static StringBuilder Join(StringBuilder sb, string sep, IConstructorArg[] types) { if (types.Length > 0) { http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/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 8228130..2581a6d 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AbstractNode.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AbstractNode.cs @@ -29,19 +29,19 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy /// 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. /// It is used for toString or debug info as AssemblyQualifiedName is really long - private readonly String name; + private readonly string name; /// It is from Type.AssemblyQualifiedName. THis name is used as full name in a Node /// It is unique for a generic type with different type of arguments. - private readonly String fullName; + private readonly string fullName; // parent node in the class hierarchy private readonly INode parent; // children in the class hierarchy - protected IDictionary<String, INode> children = new MonotonicTreeMap<string, INode>(); + protected IDictionary<string, INode> children = new MonotonicTreeMap<string, INode>(); - public AbstractNode(INode parent, String name, String fullName) + public AbstractNode(INode parent, string name, string fullName) { this.parent = parent; this.name = name; @@ -57,12 +57,12 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy return children.Values; } - public bool Contains(String key) + public bool Contains(string key) { return children.ContainsKey(key); } - public INode Get(String key) + public INode Get(string key) { INode val; if (children.TryGetValue(key, out val)) @@ -92,7 +92,7 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy return parent; } - public override bool Equals(Object o) + public override bool Equals(object o) { if (o == null) { @@ -133,7 +133,7 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy return fullName.GetHashCode(); } - public override String ToString() + public override string ToString() { return "[" + this.GetType().FullName + " '" + fullName + "']"; } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AvroClassHierarchy.cs ---------------------------------------------------------------------- diff --git a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AvroClassHierarchy.cs b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AvroClassHierarchy.cs index 70dc67f..6ffdecd 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AvroClassHierarchy.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AvroClassHierarchy.cs @@ -77,11 +77,11 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy private void ParseSubHierarchy(INode parent, AvroNode n) { INode parsed = null; - if (n.packageNode != null && !n.packageNode.Equals("")) + if (n.packageNode != null && !n.packageNode.Equals(string.Empty)) { parsed = new PackageNodeImpl(parent, n.name, n.fullName); } - else if (n.namedParameterNode != null && !n.namedParameterNode.Equals("")) + else if (n.namedParameterNode != null && !n.namedParameterNode.Equals(string.Empty)) { AvroNamedParameterNode np = (AvroNamedParameterNode)n.namedParameterNode; parsed = new NamedParameterNodeImpl(parent, n.name, @@ -89,7 +89,7 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy np.isSet, np.isList, np.documentation, np.shortName, np.instanceDefault.ToArray()); } - else if (n.classNode != null && !n.classNode.Equals("")) + else if (n.classNode != null && !n.classNode.Equals(string.Empty)) { AvroClassNode cn = (AvroClassNode)n.classNode; IList<IConstructorDef> injectableConstructors = new List<IConstructorDef>(); @@ -125,7 +125,7 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy private void WireUpInheritanceRelationships(AvroNode n) { - if (n.classNode != null && !n.classNode.Equals("")) + if (n.classNode != null && !n.classNode.Equals(string.Empty)) { AvroClassNode cn = (AvroClassNode)n.classNode; IClassNode iface = null; @@ -197,7 +197,7 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy private void AddAlias(INamedParameterNode np) { - if (np.GetAlias() != null && !np.GetAlias().Equals("")) + if (np.GetAlias() != null && !np.GetAlias().Equals(string.Empty)) { IDictionary<string, string> mapping = null; _aliasLookupTable.TryGetValue(np.GetAliasLanguage().ToString(), out mapping); http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/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 f5409f2..b308fa5 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AvroClassHierarchySerializer.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/AvroClassHierarchySerializer.cs @@ -256,13 +256,13 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy return null; } - private AvroNode NewClassNode(String name, - String fullName, + private AvroNode NewClassNode(string name, + string fullName, bool isInjectionCandidate, bool isExternalConstructor, bool isUnit, IList<AvroConstructorDef> injectableConstructors, IList<AvroConstructorDef> otherConstructors, - IList<String> implFullNames, IList<AvroNode> children) + IList<string> implFullNames, IList<AvroNode> children) { AvroClassNode classNode = new AvroClassNode(); http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/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 a07cd37..46e87d0 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ClassHierarchyImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ClassHierarchyImpl.cs @@ -64,8 +64,9 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy rootNode = NodeFactory.CreateRootPackageNode(); loader = new AssemblyLoader(assemblies); - foreach (Type p in parameterParsers) // p must be extend from IExternalConstructor + foreach (Type p in parameterParsers) { + // p must be extend from IExternalConstructor try { Parameterparser.AddParser(p); @@ -294,7 +295,7 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy } string shortName = np.GetShortName(); - if (shortName != null && !shortName.Equals("")) + if (shortName != null && !shortName.Equals(string.Empty)) { INamedParameterNode oldNode = null; shortNames.TryGetValue(shortName, out oldNode); @@ -583,7 +584,7 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy public object ParseDefaultValue(INamedParameterNode name) { string[] vals = name.GetDefaultInstanceAsStrings(); - object[] ret = new Object[vals.Length]; + object[] ret = new object[vals.Length]; for (int i = 0; i < vals.Length; i++) { string val = vals[i]; http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/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 b19a94b..aee27d8 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ClassNodeImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ClassNodeImpl.cs @@ -37,13 +37,13 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy private readonly IList<IConstructorDef> injectableConstructors; private readonly IList<IConstructorDef> allConstructors; private readonly MonotonicSet<IClassNode> knownImpls; - private readonly String defaultImpl; + private readonly string defaultImpl; - public ClassNodeImpl(INode parent, String simpleName, String fullName, + public ClassNodeImpl(INode parent, string simpleName, string fullName, bool unit, bool injectable, bool externalConstructor, IList<IConstructorDef> injectableConstructors, IList<IConstructorDef> allConstructors, - String defaultImplementation) + string defaultImplementation) : base(parent, simpleName, fullName) { this.unit = unit; @@ -75,7 +75,7 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy return externalConstructor; } - public override String ToString() + public override string ToString() { StringBuilder sb = new StringBuilder(base.ToString() + ": "); if (GetInjectableConstructors() != null) @@ -148,7 +148,7 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy return false; } - public String GetDefaultImplementation() + public string GetDefaultImplementation() { return defaultImpl; } http://git-wip-us.apache.org/repos/asf/reef/blob/b73c2229/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 b8eb385..3826b31 100644 --- a/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ConstructorArgImpl.cs +++ b/lang/cs/Org.Apache.REEF.Tang/Implementations/ClassHierarchy/ConstructorArgImpl.cs @@ -24,11 +24,11 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy { public class ConstructorArgImpl : IConstructorArg { - private readonly String type; - private readonly String name; + private readonly string type; + private readonly string name; private readonly bool isInjectionFuture; - public ConstructorArgImpl(String type, String namedParameterName, bool isInjectionFuture) + public ConstructorArgImpl(string type, string namedParameterName, bool isInjectionFuture) { this.type = type; this.name = namedParameterName; @@ -58,7 +58,7 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy return isInjectionFuture; } - public override String ToString() + public override string ToString() { return name == null ? type : type + " " + name; } @@ -68,7 +68,7 @@ namespace Org.Apache.REEF.Tang.Implementations.ClassHierarchy return 0; } - public override bool Equals(Object o) + public override bool Equals(object o) { ConstructorArgImpl arg = (ConstructorArgImpl)o; if (!type.Equals(arg.type))
