├── .gitignore ├── .travis.yml ├── CODE-OF-CONDUCT.md ├── LICENSE.txt ├── README.md ├── appveyor.yml ├── pom.xml ├── src ├── main │ ├── resources │ │ └── sharpen.properties │ └── sharpen │ │ └── core │ │ ├── AbstractNestedClassBuilder.java │ │ ├── Annotations.java │ │ ├── Bindings.java │ │ ├── CRefBuilder.java │ │ ├── CSAnonymousClassBuilder.java │ │ ├── CSharpBuilder.java │ │ ├── Configuration.java │ │ ├── ConfigurationFactory.java │ │ ├── DefaultConfiguration.java │ │ ├── DocumentationOverlay.java │ │ ├── JavaProjectCmd.java │ │ ├── Mappings.java │ │ ├── MemberKind.java │ │ ├── NameScope.java │ │ ├── NamingStrategy.java │ │ ├── NonStaticNestedClassBuilder.java │ │ ├── NullDocumentationOverlay.java │ │ ├── PascalCaseIdentifiersNamingStrategy.java │ │ ├── PascalCaseNamingStrategy.java │ │ ├── PreserveFullyQualifiedNamesState.java │ │ ├── Sharpen.java │ │ ├── SharpenAnnotations.java │ │ ├── SharpenApplication.java │ │ ├── SharpenCmd.java │ │ ├── SharpenCommandLine.java │ │ ├── SharpenCommandLineParser.java │ │ ├── SharpenConstants.java │ │ ├── SharpenConversion.java │ │ ├── SharpenConversionBatch.java │ │ ├── StandaloneConverter.java │ │ ├── VODConfiguration.java │ │ ├── WarningHandler.java │ │ ├── XmlDocumentationOverlay.java │ │ ├── csharp │ │ ├── CSharpPrinter.java │ │ └── ast │ │ │ ├── CSAbstractInvocation.java │ │ │ ├── CSArrayCreationExpression.java │ │ │ ├── CSArrayInitializerExpression.java │ │ │ ├── CSArrayTypeReference.java │ │ │ ├── CSAttribute.java │ │ │ ├── CSBaseExpression.java │ │ │ ├── CSBlock.java │ │ │ ├── CSBlockComment.java │ │ │ ├── CSBlockStatement.java │ │ │ ├── CSBoolLiteralExpression.java │ │ │ ├── CSBreakStatement.java │ │ │ ├── CSCaseClause.java │ │ │ ├── CSCastExpression.java │ │ │ ├── CSCatchClause.java │ │ │ ├── CSCharLiteralExpression.java │ │ │ ├── CSClass.java │ │ │ ├── CSClassModifier.java │ │ │ ├── CSComment.java │ │ │ ├── CSCompilationUnit.java │ │ │ ├── CSConditionalExpression.java │ │ │ ├── CSConstructor.java │ │ │ ├── CSConstructorInvocationExpression.java │ │ │ ├── CSConstructorModifier.java │ │ │ ├── CSContinueStatement.java │ │ │ ├── CSDeclarationExpression.java │ │ │ ├── CSDeclarationStatement.java │ │ │ ├── CSDelegate.java │ │ │ ├── CSDestructor.java │ │ │ ├── CSDoStatement.java │ │ │ ├── CSDocAttributeNode.java │ │ │ ├── CSDocNode.java │ │ │ ├── CSDocTagNode.java │ │ │ ├── CSDocTextNode.java │ │ │ ├── CSDocTextOverlay.java │ │ │ ├── CSEnum.java │ │ │ ├── CSEnumValue.java │ │ │ ├── CSEvent.java │ │ │ ├── CSExpression.java │ │ │ ├── CSExpressionStatement.java │ │ │ ├── CSExpressionVisitor.java │ │ │ ├── CSField.java │ │ │ ├── CSFieldModifier.java │ │ │ ├── CSForEachStatement.java │ │ │ ├── CSForStatement.java │ │ │ ├── CSGotoStatement.java │ │ │ ├── CSIfStatement.java │ │ │ ├── CSIndexedExpression.java │ │ │ ├── CSInfixExpression.java │ │ │ ├── CSInterface.java │ │ │ ├── CSLabelStatement.java │ │ │ ├── CSLineComment.java │ │ │ ├── CSLockStatement.java │ │ │ ├── CSMacro.java │ │ │ ├── CSMacroExpression.java │ │ │ ├── CSMacroTypeReference.java │ │ │ ├── CSMember.java │ │ │ ├── CSMemberReferenceExpression.java │ │ │ ├── CSMetaMember.java │ │ │ ├── CSMethod.java │ │ │ ├── CSMethodBase.java │ │ │ ├── CSMethodInvocationExpression.java │ │ │ ├── CSMethodModifier.java │ │ │ ├── CSNode.java │ │ │ ├── CSNullLiteralExpression.java │ │ │ ├── CSNumberLiteralExpression.java │ │ │ ├── CSParameterized.java │ │ │ ├── CSParenthesizedExpression.java │ │ │ ├── CSPostfixExpression.java │ │ │ ├── CSPrefixExpression.java │ │ │ ├── CSProperty.java │ │ │ ├── CSReferenceExpression.java │ │ │ ├── CSRemovedExpression.java │ │ │ ├── CSReturnStatement.java │ │ │ ├── CSStatement.java │ │ │ ├── CSStringLiteralExpression.java │ │ │ ├── CSStruct.java │ │ │ ├── CSSwitchStatement.java │ │ │ ├── CSThisExpression.java │ │ │ ├── CSThrowStatement.java │ │ │ ├── CSTryStatement.java │ │ │ ├── CSType.java │ │ │ ├── CSTypeArgumentProvider.java │ │ │ ├── CSTypeArgumentSupport.java │ │ │ ├── CSTypeDeclaration.java │ │ │ ├── CSTypeParameter.java │ │ │ ├── CSTypeParameterProvider.java │ │ │ ├── CSTypeReference.java │ │ │ ├── CSTypeReferenceExpression.java │ │ │ ├── CSTypedMember.java │ │ │ ├── CSTypeofExpression.java │ │ │ ├── CSUnaryExpression.java │ │ │ ├── CSUncheckedExpression.java │ │ │ ├── CSUsing.java │ │ │ ├── CSUsingStatement.java │ │ │ ├── CSVariableDeclaration.java │ │ │ ├── CSVisibility.java │ │ │ ├── CSVisitor.java │ │ │ ├── CSWhileStatement.java │ │ │ └── CSharpCode.java │ │ ├── framework │ │ ├── ASTResolver.java │ │ ├── ASTUtility.java │ │ ├── BindingUtils.java │ │ ├── ByRef.java │ │ ├── CommandLineParser.java │ │ ├── CompilationUnitPair.java │ │ ├── ConsoleProgressMonitor.java │ │ ├── ConversionBatch.java │ │ ├── DefaultASTResolver.java │ │ ├── DynamicVariable.java │ │ ├── Environment.java │ │ ├── Environments.java │ │ ├── Function.java │ │ ├── JavadocUtility.java │ │ ├── NameUtility.java │ │ ├── Producer.java │ │ ├── StaticImports.java │ │ └── Types.java │ │ ├── internal │ │ ├── AnnotationsImpl.java │ │ ├── BindingsImpl.java │ │ ├── MappingsImpl.java │ │ ├── NameScopeImpl.java │ │ └── PreserveFullyQualifiedNamesStateImpl.java │ │ └── io │ │ ├── IO.java │ │ └── IndentedWriter.java └── test │ ├── resources │ ├── AbstractClass1.cs.txt │ ├── AbstractClass1.java.txt │ ├── AnotherEmptyClass.cs.txt │ ├── AnotherEmptyClass.java.txt │ ├── Arrays1.cs.txt │ ├── Arrays1.java.txt │ ├── Arrays2.cs.txt │ ├── Arrays2.java.txt │ ├── Arrays3.cs.txt │ ├── Arrays3.java.txt │ ├── Arrays4.cs.txt │ ├── Arrays4.java.txt │ ├── Arrays5.cs.txt │ ├── Arrays5.java.txt │ ├── Attributes.cs.txt │ ├── Attributes.java.txt │ ├── BinaryExpressions1.cs.txt │ ├── BinaryExpressions1.java.txt │ ├── Cast1.cs.txt │ ├── Cast1.java.txt │ ├── Cast2.cs.txt │ ├── Cast2.java.txt │ ├── Catch1.cs.txt │ ├── Catch1.java.txt │ ├── CharLiteral1.cs.txt │ ├── CharLiteral1.java.txt │ ├── ClassLiterals1.cs.txt │ ├── ClassLiterals1.java.txt │ ├── Clone1.cs.txt │ ├── Clone1.java.txt │ ├── ConstString1.cs.txt │ ├── ConstString1.java.txt │ ├── ConstString2.cs.txt │ ├── ConstString2.java.txt │ ├── Constructors1.cs.txt │ ├── Constructors1.java.txt │ ├── Constructors2.cs.txt │ ├── Constructors2.java.txt │ ├── Continue1.cs.txt │ ├── Continue1.java.txt │ ├── DeadBranchElimination1.cs.txt │ ├── DeadBranchElimination1.java.txt │ ├── DoWhile1.cs.txt │ ├── DoWhile1.java.txt │ ├── EmptyClass.cs.txt │ ├── EmptyClass.java.txt │ ├── EntryPoint1.cs.txt │ ├── EntryPoint1.java.txt │ ├── EntryPoint2.cs.txt │ ├── EntryPoint2.java.txt │ ├── Enum1.cs.txt │ ├── Enum1.java.txt │ ├── ExceptionMapping1.cs.txt │ ├── ExceptionMapping1.java.txt │ ├── Extends.cs.txt │ ├── Extends.java.txt │ ├── ExternalMethodMapping.cs.txt │ ├── ExternalMethodMapping.java.txt │ ├── FieldMapping.cs.txt │ ├── FieldMapping.java.txt │ ├── Fields1.cs.txt │ ├── Fields1.java.txt │ ├── Fields2.cs.txt │ ├── Fields2.java.txt │ ├── FinalClass1.cs.txt │ ├── FinalClass1.java.txt │ ├── FinalMethod1.cs.txt │ ├── FinalMethod1.java.txt │ ├── FinalMethod2.cs.txt │ ├── FinalMethod2.java.txt │ ├── Finalize1.cs.txt │ ├── Finalize1.java.txt │ ├── For1.cs.txt │ ├── For1.java.txt │ ├── For2.cs.txt │ ├── For2.java.txt │ ├── ForEach1.cs.txt │ ├── ForEach1.java.txt │ ├── ForEach2.cs.txt │ ├── ForEach2.java.txt │ ├── GetClass1.cs.txt │ ├── GetClass1.java.txt │ ├── HeaderSupport.cs.txt │ ├── HeaderSupport.java.txt │ ├── If1.cs.txt │ ├── If1.java.txt │ ├── If2.cs.txt │ ├── If2.java.txt │ ├── Initializers.cs.txt │ ├── Initializers.java.txt │ ├── InstanceOf1.cs.txt │ ├── InstanceOf1.java.txt │ ├── IntLiterals1.cs.txt │ ├── IntLiterals1.java.txt │ ├── Interface1.cs.txt │ ├── Interface1.java.txt │ ├── InterfaceImplementation3.cs.txt │ ├── InterfaceImplementation3.java.txt │ ├── InterfaceImplementation4.cs.txt │ ├── InterfaceImplementation4.java.txt │ ├── InterfaceImplementation5.cs.txt │ ├── InterfaceImplementation5.java.txt │ ├── InterfaceImplementation6.cs.txt │ ├── InterfaceImplementation6.java.txt │ ├── InterfaceImplementation7.cs.txt │ ├── InterfaceImplementation7.java.txt │ ├── InterfaceInheritance1.cs.txt │ ├── InterfaceInheritance1.java.txt │ ├── JavaArray1.cs.txt │ ├── JavaArray1.java.txt │ ├── JavaLang1.cs.txt │ ├── JavaLang1.java.txt │ ├── JavaSystem1.cs.txt │ ├── JavaSystem1.java.txt │ ├── KeywordMapping1.cs.txt │ ├── KeywordMapping1.java.txt │ ├── Labels.cs.txt │ ├── Labels.java.txt │ ├── LongLine1.cs.txt │ ├── LongLine1.java.txt │ ├── MemberRef1.cs.txt │ ├── MemberRef1.java.txt │ ├── MethodNameMappingInHierarchy1.cs.txt │ ├── MethodNameMappingInHierarchy1.java.txt │ ├── MethodNameMappingInHierarchy2.cs.txt │ ├── MethodNameMappingInHierarchy2.java.txt │ ├── NestedInterface1.cs.txt │ ├── NestedInterface1.java.txt │ ├── ObjectMethods1.cs.txt │ ├── ObjectMethods1.java.txt │ ├── ObjectMethods2.cs.txt │ ├── ObjectMethods2.java.txt │ ├── ObjectMethods3.cs.txt │ ├── ObjectMethods3.java.txt │ ├── ObjectMethods4.cs.txt │ ├── ObjectMethods4.java.txt │ ├── Partial.cs.txt │ ├── Partial.java.txt │ ├── PostfixExpressions1.cs.txt │ ├── PostfixExpressions1.java.txt │ ├── PrintStackTrace1.cs.txt │ ├── PrintStackTrace1.java.txt │ ├── Return1.cs.txt │ ├── Return1.java.txt │ ├── Return2.cs.txt │ ├── Return2.java.txt │ ├── Serializable1.cs.txt │ ├── Serializable1.java.txt │ ├── Serializable2.cs.txt │ ├── Serializable2.java.txt │ ├── Serializable3.cs.txt │ ├── Serializable3.java.txt │ ├── SignatureMapping.cs.txt │ ├── SignatureMapping.java.txt │ ├── StandardConstants1.cs.txt │ ├── StandardConstants1.java.txt │ ├── StaticBlocks1.cs.txt │ ├── StaticBlocks1.java.txt │ ├── StaticFinalField1.cs.txt │ ├── StaticFinalField1.java.txt │ ├── StringEmpty.cs.txt │ ├── StringEmpty.java.txt │ ├── StringMethods1.cs.txt │ ├── StringMethods1.java.txt │ ├── Super1.cs.txt │ ├── Super1.java.txt │ ├── Super2.cs.txt │ ├── Super2.java.txt │ ├── SwitchCase1.cs.txt │ ├── SwitchCase1.java.txt │ ├── SwitchCase2.cs.txt │ ├── SwitchCase2.java.txt │ ├── SwitchCaseDefaultThrows.cs.txt │ ├── SwitchCaseDefaultThrows.java.txt │ ├── SynchronizedBlock1.cs.txt │ ├── SynchronizedBlock1.java.txt │ ├── SynchronizedMethod1.cs.txt │ ├── SynchronizedMethod1.java.txt │ ├── TernaryOperator1.cs.txt │ ├── TernaryOperator1.java.txt │ ├── Throw1.cs.txt │ ├── Throw1.java.txt │ ├── Transient1.cs.txt │ ├── Transient1.java.txt │ ├── Try1.cs.txt │ ├── Try1.java.txt │ ├── Try2.cs.txt │ ├── Try2.java.txt │ ├── UnsignedRightShift.cs.txt │ ├── UnsignedRightShift.java.txt │ ├── VarArgs.cs.txt │ ├── VarArgs.java.txt │ ├── WaitNotify1.cs.txt │ ├── WaitNotify1.java.txt │ ├── While1.cs.txt │ ├── While1.java.txt │ ├── WrapperTypesMethods1.cs.txt │ ├── WrapperTypesMethods1.java.txt │ ├── annotations │ │ ├── CompilerAnnotations.cs.txt │ │ ├── CompilerAnnotations.java.txt │ │ ├── SimpleAnnotation.cs.txt │ │ └── SimpleAnnotation.java.txt │ ├── autocasting │ │ ├── Char.cs.txt │ │ ├── Char.java.txt │ │ ├── Hex.cs.txt │ │ └── Hex.java.txt │ ├── builder │ │ ├── EmptyClass.cs.txt │ │ ├── EmptyClass.java.txt │ │ ├── EmptyInterface.cs.txt │ │ └── EmptyInterface.java.txt │ ├── collections │ │ ├── CollectionToArray.cs.txt │ │ ├── CollectionToArray.java.txt │ │ ├── ComparatorSort.cs.txt │ │ ├── ComparatorSort.java.txt │ │ ├── EntrySet1.cs.txt │ │ ├── EntrySet1.java.txt │ │ ├── Hashtable1.cs.txt │ │ ├── Hashtable1.java.txt │ │ ├── Iterator1.cs.txt │ │ ├── Iterator1.java.txt │ │ ├── List1.cs.txt │ │ ├── List1.java.txt │ │ ├── Map1.cs.txt │ │ ├── Map1.java.txt │ │ ├── Set.cs.txt │ │ ├── Set.java.txt │ │ ├── Vector1.cs.txt │ │ └── Vector1.java.txt │ ├── comments │ │ ├── AfterMethods.cs.txt │ │ ├── AfterMethods.java.txt │ │ ├── BodyBlock.cs.txt │ │ ├── BodyBlock.java.txt │ │ ├── HeaderBlock.cs.txt │ │ ├── HeaderBlock.java.txt │ │ ├── Statements.cs.txt │ │ └── Statements.java.txt │ ├── disable │ │ ├── DisableClass.cs.txt │ │ ├── DisableClass.java.txt │ │ ├── DisableCompilationUnit.cs.txt │ │ ├── DisableCompilationUnit.java.txt │ │ ├── DisableInnerClass.cs.txt │ │ ├── DisableInnerClass.java.txt │ │ ├── DisableMethod.cs.txt │ │ ├── DisableMethod.java.txt │ │ ├── DisabledMethodInInterface.cs.txt │ │ ├── DisabledMethodInInterface.java.txt │ │ ├── NotSubjectToConditionalCompilation.cs.txt │ │ ├── NotSubjectToConditionalCompilation.java.txt │ │ └── disabled │ │ │ ├── TypeSubjectToConditionalCompilation.cs.txt │ │ │ ├── TypeSubjectToConditionalCompilation.java.txt │ │ │ └── subpackage │ │ │ ├── TypesInSubPackagesShouldBeDisabledAlso.cs.txt │ │ │ └── TypesInSubPackagesShouldBeDisabledAlso.java.txt │ ├── events │ │ ├── EventConsumer.cs.txt │ │ ├── EventConsumer.java.txt │ │ ├── EventInClassInterface.cs.txt │ │ ├── EventInClassInterface.java.txt │ │ ├── EventInterface.cs.txt │ │ ├── EventInterface.java.txt │ │ ├── EventInterfaceImpl.cs.txt │ │ ├── EventInterfaceImpl.java.txt │ │ ├── EventMapping.cs.txt │ │ ├── EventMapping.java.txt │ │ └── EventMappingLib.java.txt │ ├── generics │ │ ├── CollectionMappings.cs.txt │ │ ├── CollectionMappings.java.txt │ │ ├── GenericClass.cs.txt │ │ ├── GenericClass.java.txt │ │ ├── GenericExtends.cs.txt │ │ ├── GenericExtends.java.txt │ │ ├── GenericImplements.cs.txt │ │ ├── GenericImplements.java.txt │ │ ├── GenericInterface.cs.txt │ │ ├── GenericInterface.java.txt │ │ ├── GenericMethodImpl.cs.txt │ │ ├── GenericMethodImpl.java.txt │ │ ├── GenericMethodParameters.cs.txt │ │ ├── GenericMethodParameters.java.txt │ │ ├── GenericMethods.cs.txt │ │ ├── GenericMethods.java.txt │ │ ├── GenericObjectConstruction.cs.txt │ │ ├── GenericObjectConstruction.java.txt │ │ ├── GenericReturnTypes.cs.txt │ │ ├── GenericReturnTypes.java.txt │ │ ├── GenericRuntimeTypeParameters.cs.txt │ │ ├── GenericRuntimeTypeParameters.java.txt │ │ ├── WildcardTypes.cs.txt │ │ └── WildcardTypes.java.txt │ ├── ignore │ │ ├── Ignore.java.txt │ │ ├── IgnoreAbstractMethod.cs.txt │ │ ├── IgnoreAbstractMethod.java.txt │ │ ├── IgnoreExtends.cs.txt │ │ ├── IgnoreExtends.java.txt │ │ ├── IgnoreExtendsOverride.cs.txt │ │ ├── IgnoreExtendsOverride.java.txt │ │ ├── IgnoreField.cs.txt │ │ ├── IgnoreField.java.txt │ │ ├── IgnoreImplements.cs.txt │ │ ├── IgnoreImplements.java.txt │ │ ├── IgnoreMethod.cs.txt │ │ └── IgnoreMethod.java.txt │ ├── imports │ │ ├── StaticImports.cs.txt │ │ ├── StaticImports.java.txt │ │ ├── StaticallyImported.cs.txt │ │ └── StaticallyImported.java.txt │ ├── innerclasses │ │ ├── AnonymousInnerClass1.cs.txt │ │ ├── AnonymousInnerClass1.java.txt │ │ ├── AnonymousInnerClass10.cs.txt │ │ ├── AnonymousInnerClass10.java.txt │ │ ├── AnonymousInnerClass11.cs.txt │ │ ├── AnonymousInnerClass11.java.txt │ │ ├── AnonymousInnerClass12.cs.txt │ │ ├── AnonymousInnerClass12.java.txt │ │ ├── AnonymousInnerClass13.cs.txt │ │ ├── AnonymousInnerClass13.java.txt │ │ ├── AnonymousInnerClass2.cs.txt │ │ ├── AnonymousInnerClass2.java.txt │ │ ├── AnonymousInnerClass3.cs.txt │ │ ├── AnonymousInnerClass3.java.txt │ │ ├── AnonymousInnerClass4.cs.txt │ │ ├── AnonymousInnerClass4.java.txt │ │ ├── AnonymousInnerClass5.cs.txt │ │ ├── AnonymousInnerClass5.java.txt │ │ ├── AnonymousInnerClass6.cs.txt │ │ ├── AnonymousInnerClass6.java.txt │ │ ├── AnonymousInnerClass7.cs.txt │ │ ├── AnonymousInnerClass7.java.txt │ │ ├── AnonymousInnerClass8.cs.txt │ │ ├── AnonymousInnerClass8.java.txt │ │ ├── AnonymousInnerClass9.cs.txt │ │ ├── AnonymousInnerClass9.java.txt │ │ ├── AnonymousWithFinalField.cs.txt │ │ ├── AnonymousWithFinalField.java.txt │ │ ├── GenericAnonymousWithAdditionalMethods.cs.txt │ │ ├── GenericAnonymousWithAdditionalMethods.java.txt │ │ ├── InnerClassInFieldInitializer.cs.txt │ │ ├── InnerClassInFieldInitializer.java.txt │ │ ├── NestedClass1.cs.txt │ │ ├── NestedClass1.java.txt │ │ ├── NestedClass2.cs.txt │ │ ├── NestedClass2.java.txt │ │ ├── NestedStaticClass1.cs.txt │ │ ├── NestedStaticClass1.java.txt │ │ ├── NestedThis.cs.txt │ │ └── NestedThis.java.txt │ ├── integration │ │ └── namespaceMapping │ │ │ ├── bar │ │ │ ├── FooUsage.cs.txt │ │ │ └── FooUsage.java.txt │ │ │ └── foo │ │ │ ├── Foo.cs.txt │ │ │ └── Foo.java.txt │ ├── interfaces │ │ ├── BaseFoo.cs.txt │ │ ├── BaseFoo.java.txt │ │ ├── DiamondImpl.cs.txt │ │ ├── DiamondImpl.java.txt │ │ ├── Foo.java.txt │ │ ├── FooImpl.cs.txt │ │ ├── FooImpl.java.txt │ │ ├── IFoo.cs.txt │ │ ├── MappedBaseFoo.cs.txt │ │ ├── MappedBaseFoo.java.txt │ │ ├── MappedFooImpl.cs.txt │ │ ├── MappedFooImpl.java.txt │ │ └── other │ │ │ └── Other.java.txt │ ├── javadoc │ │ ├── Deprecated.cs.txt │ │ ├── Deprecated.java.txt │ │ ├── GenericTypeReference.cs.txt │ │ ├── GenericTypeReference.java.txt │ │ ├── Javadoc1.cs.txt │ │ ├── Javadoc1.java.txt │ │ ├── LinkWithLabel.cs.txt │ │ ├── LinkWithLabel.java.txt │ │ ├── PropertyParamTag.cs.txt │ │ ├── PropertyParamTag.java.txt │ │ ├── XmlDocOverlay.cs.txt │ │ ├── XmlDocOverlay.java.txt │ │ ├── XmlDocOverlay.xml │ │ └── javadoc.IEventInterface.xml │ ├── macro │ │ ├── MethodMacro.cs.txt │ │ ├── MethodMacro.java.txt │ │ ├── TypeMacro.cs.txt │ │ └── TypeMacro.java.txt │ ├── mappings │ │ ├── RemovedConstructor.cs.txt │ │ └── RemovedConstructor.java.txt │ ├── modifiers │ │ ├── New.cs.txt │ │ ├── New.java.txt │ │ ├── Override1.cs.txt │ │ ├── Override1.java.txt │ │ ├── Override2.cs.txt │ │ ├── Override2.java.txt │ │ ├── Override3.cs.txt │ │ ├── Override3.java.txt │ │ ├── Override4.cs.txt │ │ ├── Override4.java.txt │ │ ├── VirtualMethod1.cs.txt │ │ └── VirtualMethod1.java.txt │ ├── mp │ │ ├── Albatross.cs.txt │ │ ├── Albatross.java.txt │ │ ├── BaseType1.cs.txt │ │ ├── BaseType1.java.txt │ │ └── nested │ │ │ ├── Parrot.cs.txt │ │ │ └── Parrot.java.txt │ ├── namespaceMapping │ │ ├── foo │ │ │ └── bar │ │ │ │ ├── Baz.cs.txt │ │ │ │ ├── Baz.java.txt │ │ │ │ ├── Gazonk.cs.txt │ │ │ │ └── Gazonk.java.txt │ │ └── out │ │ │ └── event │ │ │ ├── Foo.cs.txt │ │ │ └── Foo.java.txt │ ├── nativeTypeSystem │ │ ├── ClassToType.cs.txt │ │ ├── ClassToType.java.txt │ │ ├── Reflection.cs.txt │ │ ├── Reflection.java.txt │ │ ├── StringMethods1.cs.txt │ │ └── StringMethods1.java.txt │ ├── problems │ │ ├── Spam.cs.txt │ │ └── Spam.java.txt │ ├── properties │ │ ├── BaseInterfaceGetter.cs.txt │ │ ├── BaseInterfaceGetter.java.txt │ │ ├── BaseInterfaceGetterImpl.cs.txt │ │ ├── BaseInterfaceGetterImpl.java.txt │ │ ├── GetterSetterProperties.cs.txt │ │ ├── GetterSetterProperties.java.txt │ │ ├── GetterSetterWithDifferentNames.cs.txt │ │ ├── GetterSetterWithDifferentNames.java.txt │ │ ├── InterfaceGetter.cs.txt │ │ ├── InterfaceGetter.java.txt │ │ ├── InterfaceGetterImpl.cs.txt │ │ ├── InterfaceGetterImpl.java.txt │ │ ├── InterfaceSetter.java.txt │ │ ├── MappedProperties.cs.txt │ │ ├── MappedProperties.java.txt │ │ ├── NonStaticNestedUsingSuperProperty.cs.txt │ │ ├── NonStaticNestedUsingSuperProperty.java.txt │ │ ├── OverrideGetter.cs.txt │ │ ├── OverrideGetter.java.txt │ │ ├── OverrideGetterConsumer.cs.txt │ │ ├── OverrideGetterConsumer.java.txt │ │ ├── SimpleGetter.cs.txt │ │ ├── SimpleGetter.java.txt │ │ ├── SimpleSetter.cs.txt │ │ ├── SimpleSetter.java.txt │ │ ├── StaticGetter.cs.txt │ │ ├── StaticGetter.java.txt │ │ ├── TestIndexer.cs.txt │ │ ├── TestIndexer.java.txt │ │ ├── TestIndexerClient.cs.txt │ │ ├── TestIndexerClient.java.txt │ │ ├── TestIndexerGeneric.cs.txt │ │ └── TestIndexerGeneric.java.txt │ ├── remove │ │ ├── RemoveAllClassesInArray.cs.txt │ │ ├── RemoveAllClassesInArray.java.txt │ │ ├── RemoveClass.cs.txt │ │ ├── RemoveClass.java.txt │ │ ├── RemoveFirst.cs.txt │ │ ├── RemoveFirst.java.txt │ │ ├── RemoveFirstInConstructor.cs.txt │ │ ├── RemoveFirstInConstructor.java.txt │ │ ├── RemoveMethod.cs.txt │ │ ├── RemoveMethod.java.txt │ │ ├── RemoveMethodByConfig.cs.txt │ │ ├── RemoveMethodByConfig.java.txt │ │ ├── RemoveMethodInExpression.cs.txt │ │ └── RemoveMethodInExpression.java.txt │ ├── renaming │ │ ├── AllUpperCaseIdentifiers.cs.txt │ │ ├── AllUpperCaseIdentifiers.java.txt │ │ ├── Renamed.cs.txt │ │ ├── RenamingInTypeHierarchy.cs.txt │ │ ├── RenamingInTypeHierarchy.java.txt │ │ ├── SimpleMethodRenaming.cs.txt │ │ ├── SimpleMethodRenaming.java.txt │ │ └── TypeRenaming.java.txt │ ├── replace │ │ ├── ReplaceExtends.cs.txt │ │ └── ReplaceExtends.java.txt │ ├── resources │ │ ├── header.txt │ │ └── options │ ├── structs │ │ ├── Struct1.cs.txt │ │ └── Struct1.java.txt │ ├── unwrap │ │ ├── Unwrap.cs.txt │ │ └── Unwrap.java.txt │ ├── usings │ │ ├── FullyQualifiedType.cs.txt │ │ ├── FullyQualifiedType.java.txt │ │ ├── Generics.cs.txt │ │ ├── Generics.java.txt │ │ ├── MethodNameConflict.cs.txt │ │ ├── MethodNameConflict.java.txt │ │ ├── NamespaceConflict.cs.txt │ │ ├── NamespaceConflict.java.txt │ │ ├── SimpleTest.cs.txt │ │ ├── SimpleTest.java.txt │ │ └── deep │ │ │ └── tree │ │ │ ├── InnerStaticClass.cs.txt │ │ │ ├── InnerStaticClass.java.txt │ │ │ ├── NestedType.cs.txt │ │ │ └── NestedType.java.txt │ └── visibility │ │ ├── Internal.cs.txt │ │ ├── Internal.java.txt │ │ ├── Private.cs.txt │ │ ├── Private.java.txt │ │ ├── Public.cs.txt │ │ └── Public.java.txt │ └── sharpen │ ├── ui │ └── tests │ │ ├── AbstractConversionTestCase.java │ │ ├── AnnotationsTestCase.java │ │ ├── ArraysTestCase.java │ │ ├── AttributesTestCase.java │ │ ├── AutoCastingTestCase.java │ │ ├── BatchConverterTestCase.java │ │ ├── BindingTestCaseSubject.java │ │ ├── BlockCommentConversionTestCase.java │ │ ├── CollectionConversionTestCase.java │ │ ├── CommandLineTestCase.java │ │ ├── CommentConversionTestCase.java │ │ ├── ConfigurationTestCase.java │ │ ├── ConstructorsTestCase.java │ │ ├── CustomConfigurationTestCase.java │ │ ├── DisableTestCase.java │ │ ├── EventConversionTestCase.java │ │ ├── GenericsTestCase.java │ │ ├── IOTestCase.java │ │ ├── IgnoreAnnotationsTestCase.java │ │ ├── ImportsTestCase.java │ │ ├── InnerClassesTestCase.java │ │ ├── IntegrationTestCase.java │ │ ├── JarUtilities.java │ │ ├── JavadocTestCase.java │ │ ├── LabelsTestCase.java │ │ ├── MacroConversionTestCase.java │ │ ├── MappingsTestCase.java │ │ ├── ModifiersTestCase.java │ │ ├── NamespaceMappingTestCase.java │ │ ├── NativeInterfacesTestCase.java │ │ ├── NativeTypeSystemTestCase.java │ │ ├── OrganizeUsingsTestCase.java │ │ ├── ProblemsOutputTestCase.java │ │ ├── PropertyConversionTestCase.java │ │ ├── RemoveTestCase.java │ │ ├── RenamingConversionsTestCase.java │ │ ├── ReplaceTestCase.java │ │ ├── ResourceUtility.java │ │ ├── SharpenCommandLineTestCase.java │ │ ├── StringAssert.java │ │ ├── TestCaseResource.java │ │ ├── UnclassifiedConversionTestCase.java │ │ ├── UnwrapTestCase.java │ │ ├── VisibilityTestCase.java │ │ └── configuration │ │ └── CustomConfiguration.java │ └── util │ ├── InputStreamUtility.java │ └── ResourceLoader.java └── travis └── before_install.sh /.gitignore: -------------------------------------------------------------------------------- 1 | bin/ 2 | bin-testcases/ 3 | target/ 4 | *.class 5 | *.byecycle 6 | 7 | 8 | # Mobile Tools for Java (J2ME) 9 | .mtj.tmp/ 10 | 11 | # Package Files # 12 | *.jar 13 | *.war 14 | *.ear 15 | 16 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 17 | hs_err_pid* 18 | /*.iml 19 | /code_quality_report.txt 20 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | jdk: 3 | - oraclejdk7 4 | before_install: 5 | - travis/before_install.sh 6 | script: mvn -DfinalName=sharpen test -q 7 | 8 | notifications: 9 | email: 10 | recipients: 11 | - nathanael.jones@gmail.com 12 | on_success: always 13 | deploy: 14 | provider: releases 15 | api_key: 16 | secure: qZtmVlKGoFdfKvSJNzn79M08KfZCatymHuhfXwn5ZdoDh5D3tqr5Z14e+uVo0DVWZuWT0RVBGFJCqL2w4xve7NNizd0Y5mkfkaZJDlyH3EPhG/EA8X/zU+28c3qk/AJnaWm0C99772C+YiFIsGu7KCC4URA0jmu5+XN9ND3mynA= 17 | file: 18 | - src/target/sharpen-jar-with-dependencies.jar 19 | - code_quality_report.txt 20 | on: 21 | repo: imazen/sharpen 22 | all_branches: true 23 | tags: true 24 | after_success: 25 | - mvn install -q -Pqulice -DskipTests -DfinalName=sharpen > code_quality_report.txt || true 26 | -------------------------------------------------------------------------------- /CODE-OF-CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | This project has adopted the code of conduct defined by the Contributor Covenant 4 | to clarify expected behavior in our community. 5 | 6 | For more information, see the [.NET Foundation Code of Conduct](https://dotnetfoundation.org/code-of-conduct). 7 | -------------------------------------------------------------------------------- /src/main/sharpen/core/Annotations.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009 Versant Inc. http://www.db4o.com */ 2 | package sharpen.core; 3 | 4 | import org.eclipse.jdt.core.dom.*; 5 | 6 | public interface Annotations { 7 | 8 | TagElement effectiveAnnotationFor(BodyDeclaration node, String annotation); 9 | 10 | String annotatedPropertyName(MethodDeclaration node); 11 | 12 | String annotatedRenaming(BodyDeclaration node); 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/main/sharpen/core/Bindings.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009 Versant Inc. http://www.db4o.com */ 2 | package sharpen.core; 3 | 4 | import org.eclipse.jdt.core.dom.*; 5 | 6 | public interface Bindings { 7 | 8 | IMethodBinding originalBindingFor(IMethodBinding binding); 9 | 10 | T findDeclaringNode(IBinding binding); 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/main/sharpen/core/Mappings.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009 Versant Inc. http://www.db4o.com */ 2 | package sharpen.core; 3 | 4 | import org.eclipse.jdt.core.dom.*; 5 | 6 | import sharpen.core.Configuration.*; 7 | 8 | public interface Mappings { 9 | 10 | String mappedFieldName(IVariableBinding binding); 11 | 12 | String mappedTypeName(ITypeBinding type); 13 | 14 | String mappedMethodName(IMethodBinding binding); 15 | 16 | MemberMapping effectiveMappingFor(IMethodBinding binding); 17 | 18 | } 19 | -------------------------------------------------------------------------------- /src/main/sharpen/core/NameScope.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009 Versant Inc. http://www.db4o.com */ 2 | package sharpen.core; 3 | 4 | import org.eclipse.jdt.core.dom.*; 5 | 6 | public interface NameScope { 7 | 8 | void enterTypeDeclaration(AbstractTypeDeclaration node); 9 | 10 | void leaveTypeDeclaration(AbstractTypeDeclaration node); 11 | 12 | AbstractTypeDeclaration currentType(); 13 | 14 | boolean contains(String name); 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/main/sharpen/core/PreserveFullyQualifiedNamesState.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009 Versant Inc. http://www.db4o.com */ 2 | package sharpen.core; 3 | 4 | public interface PreserveFullyQualifiedNamesState { 5 | 6 | void using(boolean value, Runnable runnable); 7 | 8 | boolean value(); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/main/sharpen/core/SharpenCmd.java: -------------------------------------------------------------------------------- 1 | package sharpen.core; 2 | 3 | /** 4 | * Main entry point 5 | */ 6 | public class SharpenCmd { 7 | 8 | public static void main(String[] args) 9 | { 10 | try { 11 | 12 | SharpenApplication AppCmd = new SharpenApplication(); 13 | AppCmd.start(args); 14 | 15 | } catch (Exception ex) { 16 | 17 | System.out.println("Faied to run. Exception:" + ex.getMessage()); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/main/sharpen/core/csharp/ast/CSExpressionVisitor.java: -------------------------------------------------------------------------------- 1 | package sharpen.core.csharp.ast; 2 | 3 | public class CSExpressionVisitor extends CSVisitor { 4 | 5 | @Override 6 | public void visit(CSConstructorInvocationExpression node) { 7 | visit((CSMethodInvocationExpression)node); 8 | } 9 | 10 | @Override 11 | public void visit(CSMethodInvocationExpression node) { 12 | visitNode(node.expression()); 13 | visitList(node.arguments()); 14 | } 15 | 16 | private void visitNode(CSNode expression) { 17 | if (null == expression) return; 18 | expression.accept(this); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/sharpen/core/csharp/ast/CSGotoStatement.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 - 2010 Versant Inc. http://www.db4o.com */ 2 | 3 | package sharpen.core.csharp.ast; 4 | 5 | /* 6 | * FIXME: only implemented for break label so far. 7 | */ 8 | public class CSGotoStatement extends CSStatement { 9 | 10 | private String _label; 11 | private CSExpression _target; 12 | 13 | public CSGotoStatement(int startPosition, String label) { 14 | super(startPosition); 15 | _label = label; 16 | } 17 | 18 | public CSGotoStatement(int startPosition, CSExpression target) { 19 | super(startPosition); 20 | _target = target; 21 | } 22 | 23 | public void accept(CSVisitor visitor) { 24 | visitor.visit(this); 25 | } 26 | 27 | public String label() { 28 | return _label; 29 | } 30 | 31 | public CSExpression target() { 32 | return _target; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /src/main/sharpen/core/csharp/ast/CSLabelStatement.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 - 2010 Versant Inc. http://www.db4o.com */ 2 | 3 | package sharpen.core.csharp.ast; 4 | 5 | public class CSLabelStatement extends CSStatement { 6 | 7 | private final String _label; 8 | 9 | public CSLabelStatement(String label) { 10 | _label = label; 11 | } 12 | 13 | @Override 14 | public void accept(CSVisitor visitor) { 15 | visitor.visit(this); 16 | 17 | } 18 | 19 | public String label() { 20 | return _label; 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/sharpen/core/csharp/ast/CSMacroExpression.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009 Versant Inc. http://www.db4o.com */ 2 | 3 | package sharpen.core.csharp.ast; 4 | 5 | 6 | public class CSMacroExpression extends CSExpression { 7 | 8 | private final CSMacro _macro; 9 | 10 | public CSMacroExpression(CSMacro macro) { 11 | _macro = macro; 12 | } 13 | 14 | @Override 15 | public void accept(CSVisitor visitor) { 16 | visitor.visit(this); 17 | } 18 | 19 | public CSNode macro() { 20 | return _macro; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/sharpen/core/csharp/ast/CSMacroTypeReference.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009 Versant Inc. http://www.db4o.com */ 2 | 3 | package sharpen.core.csharp.ast; 4 | 5 | 6 | public class CSMacroTypeReference extends CSTypeReferenceExpression { 7 | 8 | private final CSMacro _macro; 9 | 10 | public CSMacroTypeReference(CSMacro macro) { 11 | _macro = macro; 12 | } 13 | 14 | @Override 15 | public void accept(CSVisitor visitor) { 16 | visitor.visit(this); 17 | } 18 | 19 | public CSNode macro() { 20 | return _macro; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/main/sharpen/core/csharp/ast/CSRemovedExpression.java: -------------------------------------------------------------------------------- 1 | package sharpen.core.csharp.ast; 2 | 3 | public class CSRemovedExpression extends CSExpression { 4 | 5 | private String _originalExpression; 6 | 7 | public CSRemovedExpression(String originalExpression) { 8 | _originalExpression = originalExpression; 9 | } 10 | 11 | @Override 12 | public String toString() { 13 | return _originalExpression; 14 | } 15 | 16 | @Override 17 | public void accept(CSVisitor visitor) { 18 | visitor.visit(this); 19 | } 20 | 21 | } 22 | -------------------------------------------------------------------------------- /src/main/sharpen/core/csharp/ast/CSTypeArgumentProvider.java: -------------------------------------------------------------------------------- 1 | package sharpen.core.csharp.ast; 2 | 3 | import java.util.*; 4 | 5 | public interface CSTypeArgumentProvider { 6 | 7 | List typeArguments(); 8 | 9 | void addTypeArgument(CSTypeReferenceExpression typeArgument); 10 | 11 | } 12 | -------------------------------------------------------------------------------- /src/main/sharpen/core/csharp/ast/CSTypeArgumentSupport.java: -------------------------------------------------------------------------------- 1 | package sharpen.core.csharp.ast; 2 | 3 | import java.util.*; 4 | 5 | public class CSTypeArgumentSupport implements CSTypeArgumentProvider { 6 | 7 | private List _arguments; 8 | 9 | public void addTypeArgument(CSTypeReferenceExpression typeArgument) { 10 | if (null == _arguments) { 11 | _arguments = new ArrayList(); 12 | } 13 | _arguments.add(typeArgument); 14 | } 15 | 16 | public List typeArguments() { 17 | if (null == _arguments) { 18 | return Collections.emptyList(); 19 | } 20 | return Collections.unmodifiableList(_arguments); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /src/main/sharpen/core/csharp/ast/CSUsingStatement.java: -------------------------------------------------------------------------------- 1 | package sharpen.core.csharp.ast; 2 | 3 | public class CSUsingStatement extends CSExpressionStatement { 4 | private CSBlock _body = new CSBlock(); 5 | 6 | public CSUsingStatement(int startPosition, CSExpression expression) { 7 | super(startPosition, expression); 8 | } 9 | 10 | @Override 11 | public void accept(CSVisitor visitor) { 12 | visitor.visit(this); 13 | } 14 | 15 | public CSBlock body() { 16 | return _body ; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/main/sharpen/core/framework/ByRef.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009 Versant Inc. http://www.db4o.com */ 2 | 3 | package sharpen.core.framework; 4 | 5 | public class ByRef { 6 | 7 | public T value; 8 | 9 | public ByRef() { 10 | } 11 | 12 | public ByRef(T initialValue) { 13 | value = initialValue; 14 | } 15 | 16 | public static ByRef newInstance() { 17 | return new ByRef(); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/main/sharpen/core/framework/ConsoleProgressMonitor.java: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | */ 4 | package sharpen.core.framework; 5 | 6 | import org.eclipse.core.runtime.*; 7 | 8 | public class ConsoleProgressMonitor extends NullProgressMonitor { 9 | public void subTask(String name) { 10 | System.out.println(name); 11 | } 12 | } -------------------------------------------------------------------------------- /src/main/sharpen/core/framework/Environment.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009 Versant Inc. http://www.db4o.com */ 2 | 3 | package sharpen.core.framework; 4 | 5 | public interface Environment { 6 | 7 | T provide(Class service); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/sharpen/core/framework/Function.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 - 2010 Versant Inc. http://www.db4o.com */ 2 | 3 | package sharpen.core.framework; 4 | 5 | public interface Function { 6 | 7 | public T apply(); 8 | 9 | } 10 | -------------------------------------------------------------------------------- /src/main/sharpen/core/framework/Producer.java: -------------------------------------------------------------------------------- 1 | package sharpen.core.framework; 2 | 3 | public interface Producer { 4 | T produce(); 5 | } 6 | -------------------------------------------------------------------------------- /src/main/sharpen/core/framework/Types.java: -------------------------------------------------------------------------------- 1 | package sharpen.core.framework; 2 | 3 | public class Types { 4 | 5 | @SuppressWarnings("unchecked") 6 | public static T cast(Object o) { 7 | return (T)o; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/main/sharpen/core/internal/PreserveFullyQualifiedNamesStateImpl.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009 Versant Inc. http://www.db4o.com */ 2 | package sharpen.core.internal; 3 | 4 | import sharpen.core.*; 5 | import sharpen.core.framework.*; 6 | 7 | public class PreserveFullyQualifiedNamesStateImpl implements PreserveFullyQualifiedNamesState { 8 | 9 | public void using(boolean value, Runnable runnable) { 10 | _value.using(value, runnable); 11 | } 12 | 13 | public boolean value() { 14 | return _value.value(); 15 | } 16 | 17 | private final DynamicVariable _value = DynamicVariable.newInstance(Boolean.FALSE); 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/AbstractClass1.cs.txt: -------------------------------------------------------------------------------- 1 | public abstract class AbstractClass1 2 | { 3 | public abstract void foo(); 4 | } -------------------------------------------------------------------------------- /src/test/resources/AbstractClass1.java.txt: -------------------------------------------------------------------------------- 1 | public abstract class AbstractClass1 { 2 | 3 | public abstract void foo(); 4 | 5 | } -------------------------------------------------------------------------------- /src/test/resources/AnotherEmptyClass.cs.txt: -------------------------------------------------------------------------------- 1 | internal class AnotherEmptyClass 2 | { 3 | } 4 | -------------------------------------------------------------------------------- /src/test/resources/AnotherEmptyClass.java.txt: -------------------------------------------------------------------------------- 1 | class AnotherEmptyClass { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/test/resources/Arrays1.cs.txt: -------------------------------------------------------------------------------- 1 | public class Arrays1 2 | { 3 | public static void Main(string[] args) 4 | { 5 | process(args); 6 | } 7 | 8 | private static void process(string[] args) 9 | { 10 | for (int i = 0; i < args.Length; ++i) 11 | { 12 | print(args[i]); 13 | } 14 | int len = (args).Length; 15 | } 16 | 17 | private static void print(object arg) 18 | { 19 | } 20 | } -------------------------------------------------------------------------------- /src/test/resources/Arrays1.java.txt: -------------------------------------------------------------------------------- 1 | public class Arrays1 { 2 | public static void main(String[] args) { 3 | process(args); 4 | } 5 | 6 | private static void process(String args[]) { 7 | for (int i=0; i b; 9 | if (!flag) 10 | { 11 | println("wow"); 12 | } 13 | } 14 | 15 | private static int prompt() 16 | { 17 | return 1; 18 | } 19 | 20 | private static void println(string text) 21 | { 22 | } 23 | } -------------------------------------------------------------------------------- /src/test/resources/BinaryExpressions1.java.txt: -------------------------------------------------------------------------------- 1 | public class BinaryExpressions1 { 2 | 3 | public static void run() { 4 | int a = prompt()*2; 5 | int b = a+5*(2-prompt()); 6 | println("a: " + a + ", " + b); 7 | 8 | boolean flag = a > b; 9 | if (!flag) { 10 | println("wow"); 11 | } 12 | 13 | } 14 | 15 | private static int prompt() { 16 | return 1; 17 | } 18 | 19 | private static void println(String text) { 20 | } 21 | } -------------------------------------------------------------------------------- /src/test/resources/Cast1.cs.txt: -------------------------------------------------------------------------------- 1 | public class Cast1 2 | { 3 | private string _name; 4 | 5 | public virtual void setName(object name) 6 | { 7 | _name = (string)name; 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/Cast1.java.txt: -------------------------------------------------------------------------------- 1 | public class Cast1 { 2 | 3 | private String _name; 4 | 5 | public void setName(Object name) { 6 | _name = (String)name; 7 | } 8 | } -------------------------------------------------------------------------------- /src/test/resources/Cast2.cs.txt: -------------------------------------------------------------------------------- 1 | public class Cast2 2 | { 3 | private string _name; 4 | 5 | public virtual void setName(object name) 6 | { 7 | try 8 | { 9 | _name = (string)name; 10 | } 11 | catch (System.InvalidCastException) 12 | { 13 | _name = null; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/test/resources/Cast2.java.txt: -------------------------------------------------------------------------------- 1 | public class Cast2 { 2 | 3 | private String _name; 4 | 5 | public void setName(Object name) { 6 | try { 7 | _name = (String)name; 8 | } catch (ClassCastException x) { 9 | _name = null; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/Catch1.java.txt: -------------------------------------------------------------------------------- 1 | public class Catch1 { 2 | public static void run() throws Throwable { 3 | try { 4 | throw new Exception("uh, oh"); 5 | } catch (Exception e) { 6 | } 7 | try { 8 | throw new Exception("oh, uh"); 9 | } catch (java.io.IOException ioe) { 10 | } 11 | try { 12 | throw new Exception("oh, uh"); 13 | } catch (java.io.IOException ioe) { 14 | bang(ioe); 15 | } 16 | } 17 | 18 | public static void bang(Object o) { 19 | } 20 | 21 | public static Object foo() throws Exception { 22 | try { 23 | throw new Exception("foo"); 24 | } catch (java.io.IOException ioe) { 25 | return null; 26 | } 27 | } 28 | 29 | public static Object bar() { 30 | try { 31 | throw new Exception("bar"); 32 | } catch (Throwable e) { 33 | return null; 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/test/resources/CharLiteral1.cs.txt: -------------------------------------------------------------------------------- 1 | public class CharLiteral1 2 | { 3 | public const char A = 'A'; 4 | } -------------------------------------------------------------------------------- /src/test/resources/CharLiteral1.java.txt: -------------------------------------------------------------------------------- 1 | public class CharLiteral1 { 2 | public static final char A = 'A'; 3 | } -------------------------------------------------------------------------------- /src/test/resources/ClassLiterals1.cs.txt: -------------------------------------------------------------------------------- 1 | public class ClassLiterals1 2 | { 3 | public static void run() 4 | { 5 | print(Sharpen.Runtime.getClassForType(typeof(string)).ToString()); 6 | print(Sharpen.Runtime.getClassForType(typeof(ClassLiterals1)).ToString()); 7 | } 8 | 9 | private static void print(string s) 10 | { 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/ClassLiterals1.java.txt: -------------------------------------------------------------------------------- 1 | public class ClassLiterals1 { 2 | public static void run() { 3 | print(java.lang.String.class.toString()); 4 | print(ClassLiterals1.class.toString()); 5 | } 6 | 7 | private static void print(String s) { 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/Clone1.cs.txt: -------------------------------------------------------------------------------- 1 | public class Clone1 : System.ICloneable 2 | { 3 | /// 4 | public virtual Clone1 copy1() 5 | { 6 | return (Clone1)MemberwiseClone(); 7 | } 8 | 9 | public static Clone1 copy2(Clone1 o) 10 | { 11 | return (Clone1)o.MemberwiseClone(); 12 | } 13 | 14 | object System.ICloneable.Clone() 15 | { 16 | return MemberwiseClone(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/Clone1.java.txt: -------------------------------------------------------------------------------- 1 | public class Clone1 implements Cloneable { 2 | public Clone1 copy1() throws Exception { 3 | return (Clone1)clone(); 4 | } 5 | public static Clone1 copy2(Clone1 o) { 6 | try { 7 | return (Clone1)o.clone(); 8 | } catch (CloneNotSupportedException x) { 9 | return null; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/ConstString1.cs.txt: -------------------------------------------------------------------------------- 1 | public class ConstString1 2 | { 3 | public const string Message = "This is an ex parrot!"; 4 | } -------------------------------------------------------------------------------- /src/test/resources/ConstString1.java.txt: -------------------------------------------------------------------------------- 1 | public class ConstString1 { 2 | public static final String Message = "This is an ex parrot!"; 3 | } -------------------------------------------------------------------------------- /src/test/resources/ConstString2.cs.txt: -------------------------------------------------------------------------------- 1 | public class ConstString2 2 | { 3 | public const string Message = "\tThis is an ex parrot!\n\tThis is parrot is no more!"; 4 | } -------------------------------------------------------------------------------- /src/test/resources/ConstString2.java.txt: -------------------------------------------------------------------------------- 1 | public class ConstString2 { 2 | public static final String Message = "\tThis is an ex parrot!\n\tThis is parrot is no more!"; 3 | } -------------------------------------------------------------------------------- /src/test/resources/Constructors1.cs.txt: -------------------------------------------------------------------------------- 1 | public class Constructors1 2 | { 3 | public Constructors1() 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/Constructors1.java.txt: -------------------------------------------------------------------------------- 1 | public class Constructors1 { 2 | public Constructors1() { 3 | } 4 | } -------------------------------------------------------------------------------- /src/test/resources/Constructors2.cs.txt: -------------------------------------------------------------------------------- 1 | public class Constructors2 2 | { 3 | public Constructors2() 4 | : this(null) 5 | { 6 | } 7 | 8 | public Constructors2(string value) 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/Constructors2.java.txt: -------------------------------------------------------------------------------- 1 | public class Constructors2 { 2 | public Constructors2() { 3 | this(null); 4 | } 5 | 6 | public Constructors2(String value) { 7 | } 8 | } -------------------------------------------------------------------------------- /src/test/resources/Continue1.cs.txt: -------------------------------------------------------------------------------- 1 | public class Continue1 2 | { 3 | public static void run() 4 | { 5 | int i = 0; 6 | while (true) 7 | { 8 | if (i > 5) 9 | { 10 | ++i; 11 | continue; 12 | } 13 | i += 2; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/test/resources/Continue1.java.txt: -------------------------------------------------------------------------------- 1 | public class Continue1 { 2 | public static void run() { 3 | int i = 0; 4 | while (true) { 5 | if (i > 5) { 6 | ++i; 7 | continue; 8 | } 9 | i += 2; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/DeadBranchElimination1.cs.txt: -------------------------------------------------------------------------------- 1 | public class DeadBranchElimination1 2 | { 3 | public const bool Debug = false; 4 | 5 | public const bool Trace = true; 6 | 7 | public static void run() 8 | { 9 | trace(); 10 | trace(); 11 | trace2(); 12 | } 13 | 14 | private static void debug() 15 | { 16 | } 17 | 18 | private static void trace() 19 | { 20 | } 21 | 22 | private static void debug2() 23 | { 24 | } 25 | 26 | private static void trace2() 27 | { 28 | } 29 | } -------------------------------------------------------------------------------- /src/test/resources/DeadBranchElimination1.java.txt: -------------------------------------------------------------------------------- 1 | public class DeadBranchElimination1 { 2 | 3 | public static final boolean Debug = false; 4 | 5 | public static final boolean Trace = true; 6 | 7 | public static void run() { 8 | if (Debug) { 9 | debug(); 10 | } 11 | if (Trace) { 12 | trace(); 13 | } 14 | if (Debug) { 15 | debug(); 16 | } else { 17 | trace(); 18 | } 19 | if (!Trace) { 20 | debug2(); 21 | } 22 | if (!Debug) { 23 | trace2(); 24 | } 25 | } 26 | 27 | private static void debug() { 28 | } 29 | 30 | private static void trace() { 31 | } 32 | 33 | private static void debug2() { 34 | } 35 | 36 | private static void trace2() { 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /src/test/resources/DoWhile1.cs.txt: -------------------------------------------------------------------------------- 1 | public class DoWhile1 2 | { 3 | public static void foo(int i) 4 | { 5 | do 6 | { 7 | --i; 8 | } 9 | while (i > 0); 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/DoWhile1.java.txt: -------------------------------------------------------------------------------- 1 | public class DoWhile1 { 2 | public static void foo(int i) { 3 | do { 4 | --i; 5 | } while (i > 0); 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/EmptyClass.cs.txt: -------------------------------------------------------------------------------- 1 | public class EmptyClass 2 | { 3 | } 4 | -------------------------------------------------------------------------------- /src/test/resources/EmptyClass.java.txt: -------------------------------------------------------------------------------- 1 | public class EmptyClass { 2 | 3 | } 4 | -------------------------------------------------------------------------------- /src/test/resources/EntryPoint1.cs.txt: -------------------------------------------------------------------------------- 1 | public class EntryPoint1 2 | { 3 | public static void Main(string[] args) 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/EntryPoint1.java.txt: -------------------------------------------------------------------------------- 1 | public class EntryPoint1 { 2 | public static void main(String[] args) { 3 | } 4 | } -------------------------------------------------------------------------------- /src/test/resources/EntryPoint2.cs.txt: -------------------------------------------------------------------------------- 1 | public class EntryPoint2 2 | { 3 | public static void Main(string[] args) 4 | { 5 | EntryPoint2Main.Main(args); 6 | } 7 | } 8 | 9 | internal class EntryPoint2Main 10 | { 11 | public static void Main(string[] args) 12 | { 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/EntryPoint2.java.txt: -------------------------------------------------------------------------------- 1 | public class EntryPoint2 { 2 | public static void main(String[] args) { 3 | EntryPoint2Main.main(args); 4 | } 5 | } 6 | 7 | class EntryPoint2Main { 8 | public static void main(String[] args) { 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/Enum1.cs.txt: -------------------------------------------------------------------------------- 1 | public enum Enum1 2 | { 3 | FOO, 4 | BAR 5 | } -------------------------------------------------------------------------------- /src/test/resources/Enum1.java.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * @sharpen.enum 3 | */ 4 | public class Enum1 { 5 | public static final Enum1 FOO = new Enum1(); 6 | public static final Enum1 BAR = new Enum1(); 7 | 8 | private Enum1() { 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/ExceptionMapping1.cs.txt: -------------------------------------------------------------------------------- 1 | public class ExceptionMapping1 2 | { 3 | public virtual void foo(object arg) 4 | { 5 | if (null == arg) 6 | { 7 | throw new System.ArgumentNullException(); 8 | } 9 | throw new System.InvalidOperationException(); 10 | } 11 | 12 | public virtual void bar(object arg) 13 | { 14 | throw new System.ArgumentException(); 15 | } 16 | 17 | /// 18 | public virtual void baz() 19 | { 20 | throw new System.Net.Sockets.SocketException(); 21 | } 22 | 23 | public virtual void gazonk() 24 | { 25 | try 26 | { 27 | baz(); 28 | } 29 | catch (System.OutOfMemoryException) 30 | { 31 | } 32 | catch (System.Exception x) 33 | { 34 | bar(x.Message); 35 | bar(x.InnerException); 36 | } 37 | } 38 | } -------------------------------------------------------------------------------- /src/test/resources/ExceptionMapping1.java.txt: -------------------------------------------------------------------------------- 1 | public class ExceptionMapping1 { 2 | public void foo(Object arg) { 3 | if (null == arg) { 4 | throw new NullPointerException(); 5 | } 6 | throw new IllegalStateException(); 7 | } 8 | 9 | public void bar(Object arg) { 10 | throw new IllegalArgumentException(); 11 | } 12 | 13 | public void baz() throws java.net.SocketException { 14 | throw new java.net.SocketException(); 15 | } 16 | 17 | public void gazonk() { 18 | try { 19 | baz(); 20 | } catch (OutOfMemoryError error) { 21 | } catch (Throwable x) { 22 | bar(x.getMessage()); 23 | bar(x.getCause()); 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/test/resources/Extends.cs.txt: -------------------------------------------------------------------------------- 1 | internal interface Foo : System.IDisposable 2 | { 3 | } -------------------------------------------------------------------------------- /src/test/resources/Extends.java.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * @sharpen.extends System.IDisposable 3 | */ 4 | interface Foo { 5 | } -------------------------------------------------------------------------------- /src/test/resources/ExternalMethodMapping.cs.txt: -------------------------------------------------------------------------------- 1 | public class ExternalMethodMapping 2 | { 3 | public virtual void Foo(sharpen.ui.tests.BindingTestCaseSubject.Baz baz) 4 | { 5 | baz.Mapped(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/ExternalMethodMapping.java.txt: -------------------------------------------------------------------------------- 1 | import sharpen.ui.tests.*; 2 | 3 | public class ExternalMethodMapping { 4 | public void foo(BindingTestCaseSubject.Baz baz) { 5 | baz.bar(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/FieldMapping.cs.txt: -------------------------------------------------------------------------------- 1 | public class FieldMapping 2 | { 3 | internal double doubleMax = double.MaxValue; 4 | 5 | internal double doubleMin = double.MinValue; 6 | 7 | internal double doubleNaN = double.NaN; 8 | 9 | internal double doubleNegativeInfinity = double.NegativeInfinity; 10 | 11 | internal double doublePositiveInfinity = double.PositiveInfinity; 12 | 13 | internal float floatMax = float.MaxValue; 14 | 15 | internal float floatMin = float.MinValue; 16 | 17 | internal float floatNaN = float.NaN; 18 | 19 | internal float floatNegativeInfinity = float.NegativeInfinity; 20 | 21 | internal float floatPositiveInfinity = float.PositiveInfinity; 22 | 23 | internal byte byteMax = byte.MaxValue; 24 | 25 | internal byte byteMin = byte.MinValue; 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/FieldMapping.java.txt: -------------------------------------------------------------------------------- 1 | public class FieldMapping { 2 | double doubleMax = Double.MAX_VALUE; 3 | 4 | double doubleMin = Double.MIN_VALUE; 5 | 6 | double doubleNaN = Double.NaN; 7 | 8 | double doubleNegativeInfinity = Double.NEGATIVE_INFINITY; 9 | 10 | double doublePositiveInfinity = Double.POSITIVE_INFINITY; 11 | 12 | float floatMax = Float.MAX_VALUE; 13 | 14 | float floatMin = Float.MIN_VALUE; 15 | 16 | float floatNaN = Float.NaN; 17 | 18 | float floatNegativeInfinity = Float.NEGATIVE_INFINITY; 19 | 20 | float floatPositiveInfinity = Float.POSITIVE_INFINITY; 21 | 22 | byte byteMax = Byte.MAX_VALUE; 23 | 24 | byte byteMin = Byte.MIN_VALUE; 25 | } 26 | -------------------------------------------------------------------------------- /src/test/resources/Fields1.java.txt: -------------------------------------------------------------------------------- 1 | public class Fields1 { 2 | 3 | private String _name; 4 | protected Integer _intValue; 5 | boolean _boolValue; 6 | public volatile boolean _stopped; 7 | private final Object _lock = new Object(); 8 | private final Object _defaultLock = _lock; 9 | private final int _readOnlyInt = 42; 10 | private static final int value = 42; 11 | private int defaultValue = value; 12 | private static final Object _typeLock = new Object(); 13 | private Object _defaultTypeLock = _typeLock; 14 | private int _staticFoo = staticFoo(); 15 | private int _instanceFoo = instanceFoo(); 16 | 17 | static int staticFoo() { 18 | return 42; 19 | } 20 | 21 | int instanceFoo() { 22 | return 42; 23 | } 24 | 25 | } -------------------------------------------------------------------------------- /src/test/resources/Fields2.cs.txt: -------------------------------------------------------------------------------- 1 | public class Fields2 2 | { 3 | protected internal string _name; 4 | 5 | public virtual string getName() 6 | { 7 | return this._name; 8 | } 9 | 10 | public virtual void setName(string name) 11 | { 12 | this._name = name; 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/Fields2.java.txt: -------------------------------------------------------------------------------- 1 | public class Fields2 { 2 | 3 | protected String _name; 4 | 5 | public String getName() { 6 | return this._name; 7 | } 8 | 9 | public void setName(String name) { 10 | this._name = name; 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/FinalClass1.cs.txt: -------------------------------------------------------------------------------- 1 | public sealed class FinalClass1 2 | { 3 | public void foo() 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/FinalClass1.java.txt: -------------------------------------------------------------------------------- 1 | public final class FinalClass1 { 2 | public void foo() { 3 | } 4 | } -------------------------------------------------------------------------------- /src/test/resources/FinalMethod1.cs.txt: -------------------------------------------------------------------------------- 1 | public class FinalMethod1 2 | { 3 | public void foo() 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/FinalMethod1.java.txt: -------------------------------------------------------------------------------- 1 | public class FinalMethod1 { 2 | public final void foo() { 3 | } 4 | } -------------------------------------------------------------------------------- /src/test/resources/FinalMethod2.cs.txt: -------------------------------------------------------------------------------- 1 | internal class FinalMethod2Base 2 | { 3 | public virtual void foo() 4 | { 5 | } 6 | } 7 | 8 | internal class FinalMethod2 : FinalMethod2Base 9 | { 10 | public sealed override void foo() 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/FinalMethod2.java.txt: -------------------------------------------------------------------------------- 1 | class FinalMethod2Base { 2 | public void foo() { 3 | } 4 | } 5 | 6 | class FinalMethod2 extends FinalMethod2Base { 7 | public final void foo() { 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/Finalize1.cs.txt: -------------------------------------------------------------------------------- 1 | public class Finalize1 2 | { 3 | public Finalize1() 4 | { 5 | } 6 | 7 | ~Finalize1() 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/Finalize1.java.txt: -------------------------------------------------------------------------------- 1 | public class Finalize1 { 2 | public Finalize1() { 3 | } 4 | 5 | protected void finalize() { 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/For1.cs.txt: -------------------------------------------------------------------------------- 1 | public class For1 2 | { 3 | public static void run() 4 | { 5 | for (int i = 0; i < 10; ++i) 6 | { 7 | int j = i; 8 | for (; j < 10; ) 9 | { 10 | plot(i, j); 11 | } 12 | } 13 | } 14 | 15 | private static void plot(int x, int y) 16 | { 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/For1.java.txt: -------------------------------------------------------------------------------- 1 | public class For1 { 2 | public static void run() { 3 | for (int i=0; i<10; ++i) { 4 | int j=i; 5 | for (; j<10;) { 6 | plot(i, j); 7 | } 8 | } 9 | } 10 | 11 | private static void plot(int x, int y) { 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/For2.cs.txt: -------------------------------------------------------------------------------- 1 | public class For2 2 | { 3 | public virtual void run(string[] args) 4 | { 5 | int j = 1; 6 | int i = 0; 7 | for (i = 3; i < 5; ++i, ++j) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/For2.java.txt: -------------------------------------------------------------------------------- 1 | public class For2 { 2 | public void run(String[] args) { 3 | int j = 1; 4 | int i = 0; 5 | for (i = 3; i<5; ++i, ++j) { 6 | } 7 | } 8 | } -------------------------------------------------------------------------------- /src/test/resources/ForEach1.cs.txt: -------------------------------------------------------------------------------- 1 | public class ForEach1 2 | { 3 | public virtual void run(string[] args) 4 | { 5 | foreach (string arg in args) 6 | { 7 | print(arg); 8 | } 9 | } 10 | 11 | public static void print(string s) 12 | { 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/ForEach1.java.txt: -------------------------------------------------------------------------------- 1 | public class ForEach1 { 2 | public void run(String[] args) { 3 | for (String arg : args) { 4 | print(arg); 5 | } 6 | } 7 | 8 | public static void print(String s) { 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/ForEach2.cs.txt: -------------------------------------------------------------------------------- 1 | internal interface Entry 2 | { 3 | } 4 | 5 | public class ForEach2 6 | { 7 | public virtual void run(string[] args) 8 | { 9 | foreach (Entry arg in entries()) 10 | { 11 | print(arg); 12 | } 13 | } 14 | 15 | private static Entry[] entries() 16 | { 17 | return null; 18 | } 19 | 20 | public static void print(object s) 21 | { 22 | } 23 | } -------------------------------------------------------------------------------- /src/test/resources/ForEach2.java.txt: -------------------------------------------------------------------------------- 1 | interface Entry { 2 | } 3 | 4 | public class ForEach2 { 5 | public void run(String[] args) { 6 | for (Entry arg : entries()) { 7 | print(arg); 8 | } 9 | } 10 | 11 | private static Entry[] entries() { 12 | return null; 13 | } 14 | 15 | public static void print(Object s) { 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/GetClass1.cs.txt: -------------------------------------------------------------------------------- 1 | public class GetClass1 2 | { 3 | public static bool isArray(object o) 4 | { 5 | return Sharpen.Runtime.getClassForObject(o).isArray(); 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/GetClass1.java.txt: -------------------------------------------------------------------------------- 1 | public class GetClass1 { 2 | public static boolean isArray(Object o) { 3 | return o.getClass().isArray(); 4 | } 5 | } -------------------------------------------------------------------------------- /src/test/resources/HeaderSupport.cs.txt: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2007 */ 2 | public class HeaderSupport 3 | { 4 | } -------------------------------------------------------------------------------- /src/test/resources/HeaderSupport.java.txt: -------------------------------------------------------------------------------- 1 | public class HeaderSupport { 2 | } -------------------------------------------------------------------------------- /src/test/resources/If1.cs.txt: -------------------------------------------------------------------------------- 1 | public class If1 2 | { 3 | public static void run(object arg) 4 | { 5 | if (isValid(arg)) 6 | { 7 | internalRun(arg); 8 | } 9 | } 10 | 11 | private static bool isValid(object arg) 12 | { 13 | return false; 14 | } 15 | 16 | private static void internalRun(object arg) 17 | { 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/resources/If1.java.txt: -------------------------------------------------------------------------------- 1 | public class If1 { 2 | public static void run(Object arg) { 3 | if (isValid(arg)) { 4 | internalRun(arg); 5 | } 6 | } 7 | 8 | private static boolean isValid(Object arg) { 9 | return false; 10 | } 11 | 12 | private static void internalRun(Object arg) { 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/If2.cs.txt: -------------------------------------------------------------------------------- 1 | public class If2 2 | { 3 | public static void run(object arg) 4 | { 5 | if (isValid(arg)) 6 | { 7 | internalRun(arg); 8 | } 9 | else 10 | { 11 | invalidArgError(arg); 12 | } 13 | } 14 | 15 | private static bool isValid(object arg) 16 | { 17 | return false; 18 | } 19 | 20 | private static void invalidArgError(object arg) 21 | { 22 | } 23 | 24 | private static void internalRun(object arg) 25 | { 26 | } 27 | } -------------------------------------------------------------------------------- /src/test/resources/If2.java.txt: -------------------------------------------------------------------------------- 1 | public class If2 { 2 | public static void run(Object arg) { 3 | if (isValid(arg)) { 4 | internalRun(arg); 5 | } else { 6 | invalidArgError(arg); 7 | } 8 | } 9 | 10 | private static boolean isValid(Object arg) { 11 | return false; 12 | } 13 | 14 | private static void invalidArgError(Object arg) { 15 | } 16 | 17 | private static void internalRun(Object arg) { 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/resources/Initializers.java.txt: -------------------------------------------------------------------------------- 1 | public class Initializers { 2 | public Initializers() { 3 | this(null); 4 | bar(null); 5 | } 6 | 7 | public Initializers(int value) { 8 | super(); 9 | bar(null); 10 | } 11 | 12 | { foo("instance 1"); } 13 | { foo("instance 2"); } 14 | 15 | public Initializers(String value) { 16 | bar(null); 17 | } 18 | 19 | static { 20 | foo("static"); 21 | } 22 | 23 | static void foo(final String m) { 24 | new Initializers() {{ 25 | bar(m); 26 | }}; 27 | } 28 | 29 | static void bar(String m) { 30 | } 31 | } 32 | 33 | class InitializerWithoutConstructor { 34 | { 35 | Initializers.foo(null); 36 | } 37 | static class Nested { 38 | } 39 | } -------------------------------------------------------------------------------- /src/test/resources/InstanceOf1.cs.txt: -------------------------------------------------------------------------------- 1 | public class InstanceOf1 2 | { 3 | public static bool isString(object obj) 4 | { 5 | return obj is string; 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/InstanceOf1.java.txt: -------------------------------------------------------------------------------- 1 | public class InstanceOf1 { 2 | public static boolean isString(Object obj) { 3 | return obj instanceof String; 4 | } 5 | } -------------------------------------------------------------------------------- /src/test/resources/IntLiterals1.cs.txt: -------------------------------------------------------------------------------- 1 | public class IntLiterals1 2 | { 3 | private const int DELTA = unchecked((int)(0x9E3779B9)); 4 | } -------------------------------------------------------------------------------- /src/test/resources/IntLiterals1.java.txt: -------------------------------------------------------------------------------- 1 | public class IntLiterals1 { 2 | 3 | private static final int DELTA = 0x9E3779B9; 4 | 5 | } -------------------------------------------------------------------------------- /src/test/resources/Interface1.cs.txt: -------------------------------------------------------------------------------- 1 | public interface Interface1 2 | { 3 | int size(); 4 | 5 | bool hasNext(); 6 | 7 | object next(); 8 | } -------------------------------------------------------------------------------- /src/test/resources/Interface1.java.txt: -------------------------------------------------------------------------------- 1 | public interface Interface1 { 2 | int size(); 3 | boolean hasNext(); 4 | Object next(); 5 | } -------------------------------------------------------------------------------- /src/test/resources/InterfaceImplementation3.cs.txt: -------------------------------------------------------------------------------- 1 | internal interface Foo 2 | { 3 | void foo(); 4 | } 5 | 6 | internal abstract class FooImpl : Foo 7 | { 8 | public abstract void foo(); 9 | } -------------------------------------------------------------------------------- /src/test/resources/InterfaceImplementation3.java.txt: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | void foo(); 3 | } 4 | 5 | abstract class FooImpl implements Foo { 6 | } -------------------------------------------------------------------------------- /src/test/resources/InterfaceImplementation4.cs.txt: -------------------------------------------------------------------------------- 1 | internal interface Foo 2 | { 3 | bool foo(int a, int b); 4 | } 5 | 6 | internal abstract class FooImpl : Foo 7 | { 8 | public abstract bool foo(int arg1, int arg2); 9 | } 10 | 11 | internal abstract class FooImpl2 : FooImpl 12 | { 13 | } -------------------------------------------------------------------------------- /src/test/resources/InterfaceImplementation4.java.txt: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | boolean foo(int a, int b); 3 | } 4 | 5 | abstract class FooImpl implements Foo { 6 | } 7 | 8 | abstract class FooImpl2 extends FooImpl { 9 | } -------------------------------------------------------------------------------- /src/test/resources/InterfaceImplementation5.cs.txt: -------------------------------------------------------------------------------- 1 | internal interface Readable 2 | { 3 | void read(); 4 | } 5 | 6 | internal interface ReadWritable : Readable 7 | { 8 | void write(); 9 | } 10 | 11 | internal class FooImpl : ReadWritable 12 | { 13 | public void read() 14 | { 15 | } 16 | 17 | public void write() 18 | { 19 | } 20 | } -------------------------------------------------------------------------------- /src/test/resources/InterfaceImplementation5.java.txt: -------------------------------------------------------------------------------- 1 | interface Readable { 2 | void read(); 3 | } 4 | 5 | interface ReadWritable extends Readable { 6 | void write(); 7 | } 8 | 9 | class FooImpl implements ReadWritable { 10 | public final void read() { 11 | } 12 | 13 | public final void write() { 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/InterfaceImplementation6.cs.txt: -------------------------------------------------------------------------------- 1 | internal interface Readable 2 | { 3 | void read(); 4 | } 5 | 6 | internal interface ReadWritable : Readable 7 | { 8 | void write(); 9 | } 10 | 11 | internal abstract class FooImpl : ReadWritable 12 | { 13 | public abstract void read(); 14 | 15 | public abstract void write(); 16 | } -------------------------------------------------------------------------------- /src/test/resources/InterfaceImplementation6.java.txt: -------------------------------------------------------------------------------- 1 | interface Readable { 2 | void read(); 3 | } 4 | 5 | interface ReadWritable extends Readable { 6 | void write(); 7 | } 8 | 9 | abstract class FooImpl implements ReadWritable { 10 | } -------------------------------------------------------------------------------- /src/test/resources/InterfaceImplementation7.cs.txt: -------------------------------------------------------------------------------- 1 | internal interface Readable 2 | { 3 | void read(); 4 | } 5 | 6 | internal class ReadableImpl 7 | { 8 | public virtual void read() 9 | { 10 | } 11 | } 12 | 13 | internal class FooImpl : ReadableImpl, Readable 14 | { 15 | } -------------------------------------------------------------------------------- /src/test/resources/InterfaceImplementation7.java.txt: -------------------------------------------------------------------------------- 1 | interface Readable { 2 | void read(); 3 | } 4 | 5 | class ReadableImpl { 6 | public void read() { 7 | } 8 | } 9 | 10 | class FooImpl extends ReadableImpl implements Readable { 11 | } -------------------------------------------------------------------------------- /src/test/resources/InterfaceInheritance1.cs.txt: -------------------------------------------------------------------------------- 1 | internal interface Foo 2 | { 3 | void foo(); 4 | } 5 | 6 | internal interface Bar : Foo 7 | { 8 | void bar(); 9 | } -------------------------------------------------------------------------------- /src/test/resources/InterfaceInheritance1.java.txt: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | void foo(); 3 | } 4 | 5 | interface Bar extends Foo { 6 | void bar(); 7 | } -------------------------------------------------------------------------------- /src/test/resources/JavaArray1.cs.txt: -------------------------------------------------------------------------------- 1 | public class JavaArray1 2 | { 3 | public static object get(object onArray, int index) 4 | { 5 | return java.lang.reflect.Array.get(onArray, index); 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/JavaArray1.java.txt: -------------------------------------------------------------------------------- 1 | import java.lang.reflect.*; 2 | 3 | public class JavaArray1 { 4 | public static Object get(Object onArray, int index) { 5 | return Array.get(onArray, index); 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/JavaLang1.cs.txt: -------------------------------------------------------------------------------- 1 | public class JavaLang1 : java.lang.Thread 2 | { 3 | } -------------------------------------------------------------------------------- /src/test/resources/JavaLang1.java.txt: -------------------------------------------------------------------------------- 1 | public class JavaLang1 extends Thread { 2 | } -------------------------------------------------------------------------------- /src/test/resources/JavaSystem1.cs.txt: -------------------------------------------------------------------------------- 1 | public class JavaSystem1 2 | { 3 | public static void Main(string[] args) 4 | { 5 | System.Console.Out.WriteLine(Sharpen.Runtime.identityHashCode("Hello!")); 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/JavaSystem1.java.txt: -------------------------------------------------------------------------------- 1 | public class JavaSystem1 { 2 | public static void main(String[] args) { 3 | System.out.println(System.identityHashCode("Hello!")); 4 | } 5 | } -------------------------------------------------------------------------------- /src/test/resources/KeywordMapping1.cs.txt: -------------------------------------------------------------------------------- 1 | public class KeywordMapping1 2 | { 3 | private string @ref; 4 | 5 | public KeywordMapping1(string @out) 6 | { 7 | string @using = @out.ToLower(); 8 | @ref = @using; 9 | @as(@ref); 10 | } 11 | 12 | public override string ToString() 13 | { 14 | return @ref; 15 | } 16 | 17 | private void @as(string @string) 18 | { 19 | } 20 | 21 | private void setFlags(bool @bool, bool @readonly) 22 | { 23 | } 24 | } -------------------------------------------------------------------------------- /src/test/resources/KeywordMapping1.java.txt: -------------------------------------------------------------------------------- 1 | public class KeywordMapping1 { 2 | 3 | private String ref; 4 | 5 | public KeywordMapping1(String out) { 6 | String using = out.toLowerCase(); 7 | ref = using; 8 | as(ref); 9 | } 10 | 11 | public String toString() { 12 | return ref; 13 | } 14 | 15 | private void as(String string) { 16 | } 17 | 18 | private void setFlags(boolean bool, boolean readonly) { 19 | } 20 | } -------------------------------------------------------------------------------- /src/test/resources/LongLine1.cs.txt: -------------------------------------------------------------------------------- 1 | public class LongLine1 2 | { 3 | public static void foo() 4 | { 5 | string bar = "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" 6 | + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" 7 | + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" 8 | + "bar" + "foo" + "bar"; 9 | string baz = "baz"; 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/LongLine1.java.txt: -------------------------------------------------------------------------------- 1 | public class LongLine1 { 2 | public static void foo() { 3 | String bar = "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar" + "foo" + "bar"; 4 | String baz = "baz"; 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/MemberRef1.cs.txt: -------------------------------------------------------------------------------- 1 | public class MemberRef1 2 | { 3 | private Member _member; 4 | 5 | internal virtual void setMember(Member member) 6 | { 7 | _member = member; 8 | } 9 | 10 | public virtual string getMemberName() 11 | { 12 | return this._member.getName(); 13 | } 14 | } 15 | 16 | internal class Member 17 | { 18 | public virtual string getName() 19 | { 20 | return null; 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/MemberRef1.java.txt: -------------------------------------------------------------------------------- 1 | public class MemberRef1 { 2 | 3 | private Member _member; 4 | 5 | void setMember(Member member) { 6 | _member = member; 7 | } 8 | 9 | public String getMemberName() { 10 | return this._member.getName(); 11 | } 12 | 13 | } 14 | 15 | class Member { 16 | 17 | public String getName() { 18 | return null; 19 | } 20 | } -------------------------------------------------------------------------------- /src/test/resources/MethodNameMappingInHierarchy1.cs.txt: -------------------------------------------------------------------------------- 1 | internal interface Foo 2 | { 3 | void Bar(); 4 | } 5 | 6 | internal abstract class BaseFoo : Foo 7 | { 8 | public virtual void Baz() 9 | { 10 | Bar(); 11 | } 12 | 13 | public abstract void Bar(); 14 | } 15 | 16 | public class MethodNameMappingInHierarchy1 : Foo 17 | { 18 | public virtual void Bar() 19 | { 20 | } 21 | 22 | public virtual void Gazonk() 23 | { 24 | Bar(); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /src/test/resources/MethodNameMappingInHierarchy1.java.txt: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | public void mappedToBar(); 3 | } 4 | 5 | abstract class BaseFoo implements Foo { 6 | 7 | public void baz() { 8 | mappedToBar(); 9 | } 10 | } 11 | 12 | public class MethodNameMappingInHierarchy1 implements Foo { 13 | 14 | public void mappedToBar() { 15 | } 16 | 17 | public void gazonk() { 18 | mappedToBar(); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/MethodNameMappingInHierarchy2.cs.txt: -------------------------------------------------------------------------------- 1 | internal interface Foo 2 | { 3 | void Bar(); 4 | } 5 | 6 | internal class BaseFoo : Foo 7 | { 8 | public virtual void Bar() 9 | { 10 | } 11 | } 12 | 13 | public class MethodNameMappingInHierarchy2 14 | { 15 | public virtual void Gazonk() 16 | { 17 | new BaseFoo().Bar(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/MethodNameMappingInHierarchy2.java.txt: -------------------------------------------------------------------------------- 1 | interface Foo { 2 | public void mappedToBar(); 3 | } 4 | 5 | class BaseFoo implements Foo { 6 | 7 | public void mappedToBar() { 8 | } 9 | } 10 | 11 | public class MethodNameMappingInHierarchy2 { 12 | 13 | public void gazonk() { 14 | new BaseFoo().mappedToBar(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/NestedInterface1.cs.txt: -------------------------------------------------------------------------------- 1 | public class NestedInterface1 2 | { 3 | public interface Foo 4 | { 5 | void foo(); 6 | } 7 | 8 | public virtual void bar() 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/NestedInterface1.java.txt: -------------------------------------------------------------------------------- 1 | public class NestedInterface1 { 2 | public interface Foo { 3 | void foo(); 4 | } 5 | 6 | public void bar() { 7 | } 8 | } -------------------------------------------------------------------------------- /src/test/resources/ObjectMethods1.cs.txt: -------------------------------------------------------------------------------- 1 | public class ObjectMethods1 2 | { 3 | public override string ToString() 4 | { 5 | return "Hello!"; 6 | } 7 | 8 | public override int GetHashCode() 9 | { 10 | return 1; 11 | } 12 | 13 | public override bool Equals(object other) 14 | { 15 | return false; 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/ObjectMethods1.java.txt: -------------------------------------------------------------------------------- 1 | public class ObjectMethods1 { 2 | 3 | public String toString() { 4 | return "Hello!"; 5 | } 6 | 7 | public int hashCode() { 8 | return 1; 9 | } 10 | 11 | public boolean equals(Object other) { 12 | return false; 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/ObjectMethods2.cs.txt: -------------------------------------------------------------------------------- 1 | internal class ObjectMethods2Base 2 | { 3 | public override string ToString() 4 | { 5 | return "base"; 6 | } 7 | } 8 | 9 | internal class ObjectMethods2 : ObjectMethods2Base 10 | { 11 | public override string ToString() 12 | { 13 | return base.ToString() + "derived"; 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/ObjectMethods2.java.txt: -------------------------------------------------------------------------------- 1 | class ObjectMethods2Base { 2 | public String toString() { 3 | return "base"; 4 | } 5 | } 6 | 7 | class ObjectMethods2 extends ObjectMethods2Base { 8 | public String toString() { 9 | return super.toString() + "derived"; 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/ObjectMethods3.cs.txt: -------------------------------------------------------------------------------- 1 | public class ObjectMethods3 2 | { 3 | public static void dump(object obj) 4 | { 5 | int code = obj.GetHashCode(); 6 | if (obj.Equals(obj)) 7 | { 8 | print(obj.ToString()); 9 | } 10 | } 11 | 12 | private static void print(string s) 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/ObjectMethods3.java.txt: -------------------------------------------------------------------------------- 1 | public class ObjectMethods3 { 2 | public static void dump(Object obj) { 3 | int code = obj.hashCode(); 4 | if (obj.equals(obj)) { 5 | print(obj.toString()); 6 | } 7 | } 8 | 9 | private static void print(String s) { 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/ObjectMethods4.cs.txt: -------------------------------------------------------------------------------- 1 | public class ObjectMethods4 2 | { 3 | public static void dump(System.Collections.Generic.KeyValuePair obj) 4 | { 5 | int code = obj.GetHashCode(); 6 | if (obj.Equals(obj)) 7 | { 8 | print(obj.ToString()); 9 | } 10 | } 11 | 12 | private static void print(string s) 13 | { 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/ObjectMethods4.java.txt: -------------------------------------------------------------------------------- 1 | public class ObjectMethods4 { 2 | public static void dump(java.util.Map.Entry obj) { 3 | int code = obj.hashCode(); 4 | if (obj.equals(obj)) { 5 | print(obj.toString()); 6 | } 7 | } 8 | 9 | private static void print(String s) { 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/Partial.cs.txt: -------------------------------------------------------------------------------- 1 | internal abstract partial class Foo 2 | { 3 | } -------------------------------------------------------------------------------- /src/test/resources/Partial.java.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * @sharpen.partial 3 | */ 4 | abstract class Foo { 5 | } -------------------------------------------------------------------------------- /src/test/resources/PostfixExpressions1.cs.txt: -------------------------------------------------------------------------------- 1 | public class PostfixExpressions1 2 | { 3 | public static void run() 4 | { 5 | int i = 0; 6 | while (i < 10) 7 | { 8 | print(i); 9 | i++; 10 | } 11 | i--; 12 | } 13 | 14 | public static void print(int i) 15 | { 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/PostfixExpressions1.java.txt: -------------------------------------------------------------------------------- 1 | public class PostfixExpressions1 { 2 | public static void run() { 3 | int i = 0; 4 | while (i < 10) { 5 | print(i); 6 | i++; 7 | } 8 | i--; 9 | } 10 | 11 | public static void print(int i) { 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/PrintStackTrace1.cs.txt: -------------------------------------------------------------------------------- 1 | public class PrintStackTrace1 2 | { 3 | public static void run() 4 | { 5 | Sharpen.Runtime.printStackTrace(new System.Exception()); 6 | System.Exception e = new System.Exception(); 7 | Sharpen.Runtime.printStackTrace(e); 8 | Sharpen.Runtime.printStackTrace(e, System.Console.Out); 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/PrintStackTrace1.java.txt: -------------------------------------------------------------------------------- 1 | public class PrintStackTrace1 { 2 | public static void run() { 3 | new Exception().printStackTrace(); 4 | Exception e = new Exception(); 5 | e.printStackTrace(); 6 | e.printStackTrace(System.out); 7 | } 8 | } -------------------------------------------------------------------------------- /src/test/resources/Return1.cs.txt: -------------------------------------------------------------------------------- 1 | public class Return1 2 | { 3 | public virtual int getValue() 4 | { 5 | return 0; 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/Return1.java.txt: -------------------------------------------------------------------------------- 1 | public class Return1 { 2 | public int getValue() { 3 | return 0; 4 | } 5 | } -------------------------------------------------------------------------------- /src/test/resources/Return2.cs.txt: -------------------------------------------------------------------------------- 1 | public class Return2 2 | { 3 | private string _name; 4 | 5 | public virtual string getName() 6 | { 7 | return _name; 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/Return2.java.txt: -------------------------------------------------------------------------------- 1 | public class Return2 { 2 | 3 | private String _name; 4 | 5 | public String getName() { 6 | return _name; 7 | } 8 | } -------------------------------------------------------------------------------- /src/test/resources/Serializable1.cs.txt: -------------------------------------------------------------------------------- 1 | [System.Serializable] 2 | internal class Foo 3 | { 4 | } -------------------------------------------------------------------------------- /src/test/resources/Serializable1.java.txt: -------------------------------------------------------------------------------- 1 | class Foo implements java.io.Serializable { 2 | } -------------------------------------------------------------------------------- /src/test/resources/Serializable2.cs.txt: -------------------------------------------------------------------------------- 1 | internal interface IBar 2 | { 3 | } -------------------------------------------------------------------------------- /src/test/resources/Serializable2.java.txt: -------------------------------------------------------------------------------- 1 | interface IBar extends java.io.Serializable { 2 | } -------------------------------------------------------------------------------- /src/test/resources/Serializable3.cs.txt: -------------------------------------------------------------------------------- 1 | 2 | internal interface IBaz 3 | { 4 | } 5 | 6 | internal interface IBar : IBaz 7 | { 8 | } 9 | 10 | [System.Serializable] 11 | internal class Bar : IBar 12 | { 13 | } -------------------------------------------------------------------------------- /src/test/resources/Serializable3.java.txt: -------------------------------------------------------------------------------- 1 | 2 | interface IBaz extends java.io.Serializable { 3 | } 4 | 5 | interface IBar extends IBaz { 6 | } 7 | 8 | class Bar implements IBar { 9 | } -------------------------------------------------------------------------------- /src/test/resources/SignatureMapping.cs.txt: -------------------------------------------------------------------------------- 1 | public class SignatureMapping 2 | { 3 | public virtual void foo() 4 | { 5 | string s = Sharpen.Runtime.getStringForBytes(new byte[0], 0, 0); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/SignatureMapping.java.txt: -------------------------------------------------------------------------------- 1 | public class SignatureMapping { 2 | public void foo() { 3 | String s = new String(new byte[0], 0, 0); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /src/test/resources/StandardConstants1.cs.txt: -------------------------------------------------------------------------------- 1 | public class StandardConstants1 2 | { 3 | public static void run() 4 | { 5 | int imax = int.MaxValue; 6 | long lmax = long.MaxValue; 7 | } 8 | } -------------------------------------------------------------------------------- /src/test/resources/StandardConstants1.java.txt: -------------------------------------------------------------------------------- 1 | public class StandardConstants1 { 2 | public static void run() { 3 | int imax = Integer.MAX_VALUE; 4 | long lmax = Long.MAX_VALUE; 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/StaticBlocks1.cs.txt: -------------------------------------------------------------------------------- 1 | public class StaticBlocks1 2 | { 3 | public static readonly string[] FOO; 4 | 5 | static StaticBlocks1() 6 | { 7 | FOO = new string[] { "foo", "bar" }; 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/StaticBlocks1.java.txt: -------------------------------------------------------------------------------- 1 | public class StaticBlocks1 { 2 | public static final String[] FOO; 3 | 4 | static { 5 | FOO = new String[] { "foo", "bar" }; 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/StaticFinalField1.cs.txt: -------------------------------------------------------------------------------- 1 | public class StaticFinalField1 2 | { 3 | public const int LifeTheUniverseAndEverything = 42; 4 | 5 | public static readonly object ObjectLock = new object(); 6 | } -------------------------------------------------------------------------------- /src/test/resources/StaticFinalField1.java.txt: -------------------------------------------------------------------------------- 1 | public class StaticFinalField1 { 2 | 3 | public static final int LifeTheUniverseAndEverything = 42; 4 | 5 | public static final Object ObjectLock = new Object(); 6 | 7 | } -------------------------------------------------------------------------------- /src/test/resources/StringEmpty.cs.txt: -------------------------------------------------------------------------------- 1 | public class StringEmpty 2 | { 3 | public string f = string.Empty; 4 | 5 | public virtual void foo() 6 | { 7 | f = string.Empty; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/StringEmpty.java.txt: -------------------------------------------------------------------------------- 1 | 2 | public class StringEmpty { 3 | 4 | public String f = ""; 5 | 6 | public void foo() { 7 | f = ""; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/StringMethods1.java.txt: -------------------------------------------------------------------------------- 1 | public class StringMethods1 { 2 | public static void run(String s) throws Exception { 3 | int i = s.indexOf("foo"); 4 | char ch = s.charAt(i); 5 | if (i < 0) { 6 | print(s.toUpperCase()); 7 | } else { 8 | int j = s.trim().lastIndexOf("foo") - s.length(); 9 | if (i == j) { 10 | print(s.toLowerCase().substring(i)); 11 | } else { 12 | print(s.substring(i, j)); 13 | } 14 | } 15 | byte[] bytes = s.getBytes("utf-8"); 16 | if (s.startsWith("foo")) print("foo"); 17 | if (s.endsWith("bar")) print("bar"); 18 | print(String.valueOf(42)); 19 | print("foo".intern()); 20 | s.compareTo("bar"); 21 | } 22 | 23 | private static void print(String s) { 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /src/test/resources/Super1.cs.txt: -------------------------------------------------------------------------------- 1 | internal class Super1Base 2 | { 3 | public virtual string foo() 4 | { 5 | return "Base.foo"; 6 | } 7 | } 8 | 9 | internal class Super1Derived : Super1Base 10 | { 11 | public override string foo() 12 | { 13 | string superFoo = base.foo(); 14 | return superFoo + "(Derived)"; 15 | } 16 | } -------------------------------------------------------------------------------- /src/test/resources/Super1.java.txt: -------------------------------------------------------------------------------- 1 | class Super1Base { 2 | 3 | public String foo() { 4 | return "Base.foo"; 5 | } 6 | 7 | } 8 | 9 | class Super1Derived extends Super1Base { 10 | public String foo() { 11 | String superFoo = super.foo(); 12 | return superFoo + "(Derived)"; 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/Super2.cs.txt: -------------------------------------------------------------------------------- 1 | internal class Super2Base 2 | { 3 | public Super2Base(string name) 4 | { 5 | } 6 | } 7 | 8 | internal class Super2Derived : Super2Base 9 | { 10 | public Super2Derived(string name) 11 | : base(name) 12 | { 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/Super2.java.txt: -------------------------------------------------------------------------------- 1 | class Super2Base { 2 | public Super2Base(String name) { 3 | } 4 | } 5 | 6 | class Super2Derived extends Super2Base { 7 | public Super2Derived(String name) { 8 | super(name); 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/SwitchCase1.cs.txt: -------------------------------------------------------------------------------- 1 | public class SwitchCase1 2 | { 3 | public static int foo(int arg) 4 | { 5 | int returnValue = -1; 6 | switch (arg) 7 | { 8 | case 1: 9 | { 10 | returnValue = 5; 11 | break; 12 | } 13 | 14 | case 42: 15 | { 16 | returnValue = 0; 17 | break; 18 | } 19 | 20 | default: 21 | { 22 | returnValue = 42; 23 | break; 24 | } 25 | } 26 | return returnValue; 27 | } 28 | } -------------------------------------------------------------------------------- /src/test/resources/SwitchCase1.java.txt: -------------------------------------------------------------------------------- 1 | public class SwitchCase1 { 2 | public static int foo(int arg) { 3 | int returnValue = -1; 4 | switch (arg) { 5 | case 1: { 6 | returnValue = 5; 7 | break; 8 | } 9 | 10 | case 42: { 11 | returnValue = 0; 12 | break; 13 | } 14 | 15 | default: { 16 | returnValue = 42; 17 | } 18 | } 19 | return returnValue; 20 | } 21 | } -------------------------------------------------------------------------------- /src/test/resources/SwitchCase2.cs.txt: -------------------------------------------------------------------------------- 1 | public class SwitchCase2 2 | { 3 | public static int foo(int arg) 4 | { 5 | switch (arg) 6 | { 7 | case 0: 8 | case 1: 9 | { 10 | return 1; 11 | } 12 | 13 | case 42: 14 | default: 15 | { 16 | return 42; 17 | } 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/test/resources/SwitchCase2.java.txt: -------------------------------------------------------------------------------- 1 | public class SwitchCase2 { 2 | public static int foo(int arg) { 3 | switch (arg) { 4 | case 0: 5 | case 1: 6 | return 1; 7 | case 42: 8 | default: 9 | return 42; 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/SwitchCaseDefaultThrows.cs.txt: -------------------------------------------------------------------------------- 1 | public class SwitchCaseDefaultThrows 2 | { 3 | public static int foo(int arg) 4 | { 5 | switch (arg) 6 | { 7 | case 0: 8 | case 1: 9 | { 10 | return 1; 11 | } 12 | 13 | case 42: 14 | default: 15 | { 16 | throw new System.ArgumentException(); 17 | } 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/resources/SwitchCaseDefaultThrows.java.txt: -------------------------------------------------------------------------------- 1 | public class SwitchCaseDefaultThrows { 2 | public static int foo(int arg) { 3 | switch (arg) { 4 | case 0: 5 | case 1: 6 | return 1; 7 | case 42: 8 | default: 9 | throw new IllegalArgumentException(); 10 | } 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /src/test/resources/SynchronizedBlock1.cs.txt: -------------------------------------------------------------------------------- 1 | public class SynchronizedBlock1 2 | { 3 | public virtual void foo() 4 | { 5 | lock (this) 6 | { 7 | bar(); 8 | } 9 | } 10 | 11 | private void bar() 12 | { 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/SynchronizedBlock1.java.txt: -------------------------------------------------------------------------------- 1 | public class SynchronizedBlock1 { 2 | public void foo() { 3 | synchronized(this) { 4 | bar(); 5 | } 6 | } 7 | 8 | private void bar() { 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/SynchronizedMethod1.cs.txt: -------------------------------------------------------------------------------- 1 | public class SynchronizedMethod1 2 | { 3 | public virtual void foo() 4 | { 5 | lock (this) 6 | { 7 | bar(); 8 | bar(); 9 | } 10 | } 11 | 12 | private void bar() 13 | { 14 | } 15 | 16 | public static void baz() 17 | { 18 | lock (typeof(SynchronizedMethod1)) 19 | { 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/SynchronizedMethod1.java.txt: -------------------------------------------------------------------------------- 1 | public class SynchronizedMethod1 { 2 | public synchronized void foo() { 3 | bar(); 4 | bar(); 5 | } 6 | 7 | private void bar() { 8 | } 9 | 10 | public static synchronized void baz() { 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/TernaryOperator1.cs.txt: -------------------------------------------------------------------------------- 1 | public class TernaryOperator1 2 | { 3 | internal int foo = true ? 1 : 0; 4 | 5 | internal int bar = (false ? true : false) ? 1 : (true ? 0 : 2); 6 | } -------------------------------------------------------------------------------- /src/test/resources/TernaryOperator1.java.txt: -------------------------------------------------------------------------------- 1 | public class TernaryOperator1 { 2 | int foo = true ? 1 : 0; 3 | int bar = (false ? true : false) ? 1 : (true ? 0 : 2); 4 | } -------------------------------------------------------------------------------- /src/test/resources/Throw1.cs.txt: -------------------------------------------------------------------------------- 1 | public class Throw1 2 | { 3 | /// 4 | public static void run() 5 | { 6 | try 7 | { 8 | throw new System.Exception("uh, oh"); 9 | } 10 | catch (System.Exception x) 11 | { 12 | throw; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/Throw1.java.txt: -------------------------------------------------------------------------------- 1 | public class Throw1 { 2 | public static void run() throws Throwable { 3 | try { 4 | throw new Exception("uh, oh"); 5 | } catch (Throwable x) { 6 | throw x; 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/Transient1.cs.txt: -------------------------------------------------------------------------------- 1 | public class Transient1 2 | { 3 | [System.NonSerialized] 4 | public string _foo; 5 | } -------------------------------------------------------------------------------- /src/test/resources/Transient1.java.txt: -------------------------------------------------------------------------------- 1 | public class Transient1 { 2 | public transient String _foo; 3 | } -------------------------------------------------------------------------------- /src/test/resources/Try1.cs.txt: -------------------------------------------------------------------------------- 1 | public class Try1 2 | { 3 | public static bool test(object arg) 4 | { 5 | try 6 | { 7 | string s = (string)arg; 8 | return true; 9 | } 10 | catch (System.InvalidCastException) 11 | { 12 | return false; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/Try1.java.txt: -------------------------------------------------------------------------------- 1 | public class Try1 { 2 | 3 | public static boolean test(Object arg) { 4 | try { 5 | String s = (String)arg; 6 | return true; 7 | } catch (ClassCastException x) { 8 | return false; 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/Try2.cs.txt: -------------------------------------------------------------------------------- 1 | public class Try2 2 | { 3 | public virtual void run() 4 | { 5 | object o = open(); 6 | try 7 | { 8 | use(o); 9 | } 10 | finally 11 | { 12 | dispose(o); 13 | } 14 | } 15 | 16 | private object open() 17 | { 18 | return null; 19 | } 20 | 21 | private void use(object o) 22 | { 23 | } 24 | 25 | private void dispose(object o) 26 | { 27 | } 28 | } -------------------------------------------------------------------------------- /src/test/resources/Try2.java.txt: -------------------------------------------------------------------------------- 1 | public class Try2 { 2 | 3 | public void run() { 4 | 5 | Object o = open(); 6 | try { 7 | use(o); 8 | } finally { 9 | dispose(o); 10 | } 11 | } 12 | 13 | private Object open() { 14 | return null; 15 | } 16 | 17 | private void use(Object o) { 18 | } 19 | 20 | private void dispose(Object o) { 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/UnsignedRightShift.cs.txt: -------------------------------------------------------------------------------- 1 | public class UnsignedRightShift 2 | { 3 | private const int DELTA = unchecked((int)(0x9E3779B9)); 4 | 5 | public virtual void run() 6 | { 7 | int a = (int)(((uint)DELTA) >> 2); 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/UnsignedRightShift.java.txt: -------------------------------------------------------------------------------- 1 | public class UnsignedRightShift { 2 | 3 | private static final int DELTA = 0x9E3779B9; 4 | 5 | public void run() { 6 | int a = DELTA >>> 2; 7 | } 8 | 9 | } -------------------------------------------------------------------------------- /src/test/resources/VarArgs.cs.txt: -------------------------------------------------------------------------------- 1 | public class VarArgs 2 | { 3 | public VarArgs(params string[] args) 4 | { 5 | } 6 | 7 | public virtual void foo(int i, params string[] args) 8 | { 9 | } 10 | 11 | internal static void run() 12 | { 13 | new VarArgs("foo", "bar").foo(42, "baz", "zong"); 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/VarArgs.java.txt: -------------------------------------------------------------------------------- 1 | public class VarArgs { 2 | 3 | public VarArgs(String... args) { 4 | } 5 | 6 | public void foo(int i, String... args) { 7 | } 8 | 9 | static void run() { 10 | new VarArgs("foo", "bar").foo(42, "baz", "zong"); 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/WaitNotify1.cs.txt: -------------------------------------------------------------------------------- 1 | public class WaitNotify1 2 | { 3 | private object _lock; 4 | 5 | /// 6 | public virtual void start() 7 | { 8 | Sharpen.Runtime.wait(_lock); 9 | Sharpen.Runtime.wait(this); 10 | } 11 | 12 | public virtual void stop() 13 | { 14 | Sharpen.Runtime.notify(this); 15 | Sharpen.Runtime.notify(_lock); 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/WaitNotify1.java.txt: -------------------------------------------------------------------------------- 1 | public class WaitNotify1 { 2 | 3 | private Object _lock; 4 | 5 | public void start() throws Exception { 6 | _lock.wait(); 7 | wait(); 8 | } 9 | 10 | public void stop() { 11 | notify(); 12 | _lock.notify(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/While1.cs.txt: -------------------------------------------------------------------------------- 1 | internal class While1 2 | { 3 | internal static void listResult(ObjectSet result) 4 | { 5 | while (result.hasNext()) 6 | { 7 | object next = result.next(); 8 | println(next); 9 | } 10 | } 11 | 12 | internal static void println(object obj) 13 | { 14 | } 15 | } 16 | 17 | internal interface ObjectSet 18 | { 19 | int size(); 20 | 21 | bool hasNext(); 22 | 23 | object next(); 24 | } -------------------------------------------------------------------------------- /src/test/resources/While1.java.txt: -------------------------------------------------------------------------------- 1 | class While1 { 2 | 3 | static void listResult(ObjectSet result) { 4 | while(result.hasNext()) { 5 | Object next = result.next(); 6 | println(next); 7 | } 8 | } 9 | 10 | static void println(Object obj) { 11 | } 12 | 13 | } 14 | 15 | interface ObjectSet { 16 | int size(); 17 | boolean hasNext(); 18 | Object next(); 19 | } -------------------------------------------------------------------------------- /src/test/resources/annotations/CompilerAnnotations.cs.txt: -------------------------------------------------------------------------------- 1 | namespace annotations 2 | { 3 | public class CompilerAnnotations 4 | { 5 | [System.Obsolete] 6 | public virtual void foo() 7 | { 8 | } 9 | 10 | public override string ToString() 11 | { 12 | return "foo"; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/annotations/CompilerAnnotations.java.txt: -------------------------------------------------------------------------------- 1 | package annotations; 2 | 3 | public class CompilerAnnotations { 4 | @Deprecated 5 | public void foo() { 6 | } 7 | 8 | @Override 9 | public String toString() { 10 | return "foo"; 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/annotations/SimpleAnnotation.cs.txt: -------------------------------------------------------------------------------- 1 | namespace annotations 2 | { 3 | internal class Annotated 4 | { 5 | [annotations.Indexed] 6 | public string field; 7 | } 8 | } -------------------------------------------------------------------------------- /src/test/resources/annotations/SimpleAnnotation.java.txt: -------------------------------------------------------------------------------- 1 | package annotations; 2 | 3 | @interface Indexed { 4 | } 5 | 6 | class Annotated { 7 | @Indexed 8 | public String field; 9 | } -------------------------------------------------------------------------------- /src/test/resources/autocasting/Char.cs.txt: -------------------------------------------------------------------------------- 1 | namespace autocasting 2 | { 3 | internal class CharAutocasting 4 | { 5 | private char _ch; 6 | 7 | private void test() 8 | { 9 | this._ch = (char)1; 10 | } 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/autocasting/Char.java.txt: -------------------------------------------------------------------------------- 1 | package autocasting; 2 | 3 | class CharAutocasting { 4 | private char _ch; 5 | 6 | private void test() { 7 | this._ch = 1; 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/autocasting/Hex.cs.txt: -------------------------------------------------------------------------------- 1 | namespace autocasting 2 | { 3 | public class Hex 4 | { 5 | public virtual void withLiterals() 6 | { 7 | withInt(unchecked((int)(0xab))); 8 | withLong(unchecked((int)(0xab))); 9 | withLong(unchecked((long)(0xabL))); 10 | withLong(unchecked((long)(0xabl))); 11 | } 12 | 13 | private void withLong(long l) 14 | { 15 | } 16 | 17 | private void withInt(int i) 18 | { 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/test/resources/autocasting/Hex.java.txt: -------------------------------------------------------------------------------- 1 | package autocasting; 2 | 3 | public class Hex { 4 | 5 | public void withLiterals() { 6 | withInt(0xab); 7 | withLong(0xab); 8 | withLong(0xabL); 9 | withLong(0xabl); 10 | } 11 | 12 | private void withLong(long l) { 13 | } 14 | 15 | private void withInt(int i) { 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/builder/EmptyClass.cs.txt: -------------------------------------------------------------------------------- 1 | namespace builder 2 | { 3 | public class EmptyClass : builder.EmptyInterface 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/builder/EmptyClass.java.txt: -------------------------------------------------------------------------------- 1 | package builder; 2 | 3 | public class EmptyClass implements EmptyInterface{ 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/test/resources/builder/EmptyInterface.cs.txt: -------------------------------------------------------------------------------- 1 | namespace builder 2 | { 3 | public interface EmptyInterface 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/builder/EmptyInterface.java.txt: -------------------------------------------------------------------------------- 1 | package builder; 2 | 3 | public interface EmptyInterface { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/test/resources/collections/CollectionToArray.cs.txt: -------------------------------------------------------------------------------- 1 | namespace collections 2 | { 3 | [System.Serializable] 4 | internal class CollectionToArray : System.Collections.ArrayList 5 | { 6 | public override object[] toArray() 7 | { 8 | return null; 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/collections/CollectionToArray.java.txt: -------------------------------------------------------------------------------- 1 | package collections; 2 | 3 | class CollectionToArray extends java.util.ArrayList{ 4 | 5 | public Object[] toArray(){ 6 | return null; 7 | } 8 | 9 | } -------------------------------------------------------------------------------- /src/test/resources/collections/ComparatorSort.cs.txt: -------------------------------------------------------------------------------- 1 | namespace Collections 2 | { 3 | public class ComparatorSort : System.Collections.IComparer 4 | { 5 | public virtual int Compare(object x, object y) 6 | { 7 | return string.CompareOrdinal(x.ToString(), y.ToString()); 8 | } 9 | 10 | public virtual void Sort(System.Collections.ArrayList list) 11 | { 12 | list.Sort(this); 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/collections/ComparatorSort.java.txt: -------------------------------------------------------------------------------- 1 | package collections; 2 | 3 | import java.util.*; 4 | 5 | public class ComparatorSort implements Comparator { 6 | 7 | public int compare(Object x, Object y) { 8 | return x.toString().compareTo(y.toString()); 9 | } 10 | 11 | public void sort(ArrayList list) { 12 | Collections.sort(list, this); 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /src/test/resources/collections/EntrySet1.cs.txt: -------------------------------------------------------------------------------- 1 | namespace collections 2 | { 3 | [System.Serializable] 4 | internal abstract class MyMap : System.Collections.Hashtable 5 | { 6 | public override java.util.Set entrySet() 7 | { 8 | return null; 9 | } 10 | 11 | public virtual void debug() 12 | { 13 | foreach (object entry in this) 14 | { 15 | } 16 | } 17 | } 18 | 19 | public class EntrySet1 20 | { 21 | internal static void printAll(System.Collections.IDictionary items) 22 | { 23 | foreach (object entry in items) 24 | { 25 | System.Collections.DictionaryEntry e = (System.Collections.DictionaryEntry)entry; 26 | print(e.Key); 27 | } 28 | } 29 | 30 | internal static void print(object o) 31 | { 32 | } 33 | } 34 | } -------------------------------------------------------------------------------- /src/test/resources/collections/EntrySet1.java.txt: -------------------------------------------------------------------------------- 1 | package collections; 2 | 3 | import java.util.*; 4 | 5 | abstract class MyMap extends HashMap { 6 | public Set entrySet() { 7 | return null; 8 | } 9 | 10 | public void debug() { 11 | for (Object entry : entrySet()) { 12 | } 13 | } 14 | } 15 | 16 | public class EntrySet1 { 17 | static void printAll(Map items) { 18 | for (Object entry : items.entrySet()) { 19 | Map.Entry e = (Map.Entry)entry; 20 | print(e.getKey()); 21 | } 22 | } 23 | 24 | static void print(Object o) { 25 | } 26 | } -------------------------------------------------------------------------------- /src/test/resources/collections/Hashtable1.cs.txt: -------------------------------------------------------------------------------- 1 | namespace collections 2 | { 3 | public class Hashtable1 4 | { 5 | public static void printAll(object collection) 6 | { 7 | System.Collections.Hashtable subject = (System.Collections.Hashtable)collection; 8 | subject["foo"] = "bar"; 9 | if (subject.Count > 0) 10 | { 11 | object found = subject["foo"]; 12 | } 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/collections/Hashtable1.java.txt: -------------------------------------------------------------------------------- 1 | package collections; 2 | 3 | import java.util.*; 4 | 5 | public class Hashtable1 { 6 | public static void printAll(Object collection) { 7 | Hashtable subject = (Hashtable)collection; 8 | subject.put("foo", "bar"); 9 | if (subject.size() > 0) { 10 | Object found = subject.get("foo"); 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/collections/Iterator1.cs.txt: -------------------------------------------------------------------------------- 1 | namespace collections 2 | { 3 | public class Iterator1 4 | { 5 | public static void printAll(object collection) 6 | { 7 | System.Collections.ICollection subject = (System.Collections.ICollection)collection; 8 | System.Collections.IEnumerator it = subject.GetEnumerator(); 9 | while (it.MoveNext()) 10 | { 11 | print(it.Current); 12 | } 13 | } 14 | 15 | public static void printAll(System.Collections.Generic.IEnumerable lines) 16 | { 17 | System.Collections.Generic.IEnumerator it = lines.GetEnumerator(); 18 | while (it.MoveNext()) 19 | { 20 | print(it.Current); 21 | } 22 | } 23 | 24 | public static void print(object o) 25 | { 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/test/resources/collections/Iterator1.java.txt: -------------------------------------------------------------------------------- 1 | package collections; 2 | 3 | import java.util.*; 4 | 5 | public class Iterator1 { 6 | public static void printAll(Object collection) { 7 | Collection subject = (Collection)collection; 8 | Iterator it = subject.iterator(); 9 | while (it.hasNext()) { 10 | print(it.next()); 11 | } 12 | } 13 | 14 | public static void printAll(Iterable lines) { 15 | Iterator it = lines.iterator(); 16 | while (it.hasNext()) { 17 | print(it.next()); 18 | } 19 | } 20 | public static void print(Object o) {} 21 | } -------------------------------------------------------------------------------- /src/test/resources/collections/List1.cs.txt: -------------------------------------------------------------------------------- 1 | namespace collections 2 | { 3 | public class List1 4 | { 5 | internal static void test() 6 | { 7 | System.Collections.IList l = new System.Collections.ArrayList(); 8 | if (l.Count > 0) 9 | { 10 | object value = l[0]; 11 | } 12 | System.Collections.ArrayList arrayList = new System.Collections.ArrayList(); 13 | Sharpen.Collections.AddAll(arrayList, l); 14 | Sharpen.Collections.ToArray(arrayList, new object[arrayList.Count]); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/collections/List1.java.txt: -------------------------------------------------------------------------------- 1 | package collections; 2 | 3 | public class List1 { 4 | static void test() { 5 | java.util.List l = new java.util.LinkedList(); 6 | if (l.size() > 0) { 7 | Object value = l.get(0); 8 | } 9 | java.util.ArrayList arrayList = new java.util.ArrayList(); 10 | arrayList.addAll(l); 11 | arrayList.toArray(new Object[arrayList.size()]); 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/collections/Map1.cs.txt: -------------------------------------------------------------------------------- 1 | namespace collections 2 | { 3 | public class Map1 4 | { 5 | internal static void test() 6 | { 7 | System.Collections.IDictionary map = new System.Collections.Hashtable(); 8 | if (map.Contains("foo")) 9 | { 10 | object value = map["foo"]; 11 | } 12 | foreach (object value_1 in map.Values) 13 | { 14 | } 15 | foreach (object key in map.Keys) 16 | { 17 | } 18 | object removed = Sharpen.Collections.Remove(map, "foo"); 19 | map["foo"] = "bar"; 20 | } 21 | 22 | internal static System.Collections.IDictionary genericSortedMap() 23 | { 24 | return new System.Collections.Generic.SortedDictionary(); 25 | } 26 | 27 | internal static System.Collections.IDictionary sortedMap() 28 | { 29 | return new System.Collections.SortedList(); 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/test/resources/collections/Map1.java.txt: -------------------------------------------------------------------------------- 1 | package collections; 2 | 3 | public class Map1 { 4 | static void test() { 5 | java.util.Map map = new java.util.HashMap(); 6 | if (map.containsKey("foo")) { 7 | Object value = map.get("foo"); 8 | } 9 | for (Object value : map.values()) { 10 | } 11 | for (Object key : map.keySet()) { 12 | } 13 | Object removed = map.remove("foo"); 14 | map.put("foo", "bar"); 15 | } 16 | 17 | static java.util.Map genericSortedMap() { 18 | return new java.util.TreeMap(); 19 | } 20 | 21 | static java.util.Map sortedMap() { 22 | return new java.util.TreeMap(); 23 | } 24 | } -------------------------------------------------------------------------------- /src/test/resources/collections/Set.cs.txt: -------------------------------------------------------------------------------- 1 | namespace collections 2 | { 3 | internal class BigSet 4 | { 5 | public System.Collections.Generic.ICollection set; 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/collections/Set.java.txt: -------------------------------------------------------------------------------- 1 | package collections; 2 | 3 | class BigSet { 4 | public java.util.Set set; 5 | } -------------------------------------------------------------------------------- /src/test/resources/collections/Vector1.cs.txt: -------------------------------------------------------------------------------- 1 | namespace collections 2 | { 3 | public class Vector1 4 | { 5 | public static void printAll(object collection) 6 | { 7 | System.Collections.ArrayList subject = (System.Collections.ArrayList)collection; 8 | subject.Add("foo"); 9 | print(subject[0]); 10 | } 11 | 12 | public static void print(object o) 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/test/resources/collections/Vector1.java.txt: -------------------------------------------------------------------------------- 1 | package collections; 2 | 3 | import java.util.*; 4 | 5 | public class Vector1 { 6 | public static void printAll(Object collection) { 7 | Vector subject = (Vector)collection; 8 | subject.addElement("foo"); 9 | print(subject.elementAt(0)); 10 | } 11 | public static void print(Object o) {} 12 | } -------------------------------------------------------------------------------- /src/test/resources/comments/AfterMethods.cs.txt: -------------------------------------------------------------------------------- 1 | namespace comments 2 | { 3 | public class AfterMethods 4 | { 5 | public virtual void foo() 6 | { 7 | } 8 | 9 | // end foo 10 | public virtual void bar() 11 | { 12 | } 13 | // end bar 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/comments/AfterMethods.java.txt: -------------------------------------------------------------------------------- 1 | package comments; 2 | 3 | public class AfterMethods { 4 | public void foo() { 5 | } 6 | // end foo 7 | 8 | public void bar() { 9 | } 10 | // end bar 11 | } -------------------------------------------------------------------------------- /src/test/resources/comments/BodyBlock.cs.txt: -------------------------------------------------------------------------------- 1 | namespace comments 2 | { 3 | public class BodyBlock 4 | { 5 | /* 6 | * Block comment tabs indented 7 | */ 8 | public virtual void foo() 9 | { 10 | } 11 | 12 | /* 13 | * Block comment spaces indented 14 | */ 15 | public virtual void bar() 16 | { 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/resources/comments/BodyBlock.java.txt: -------------------------------------------------------------------------------- 1 | package comments; 2 | 3 | public class BodyBlock { 4 | 5 | /* 6 | * Block comment tabs indented 7 | */ 8 | 9 | public void foo() { 10 | } 11 | 12 | /* 13 | * Block comment spaces indented 14 | */ 15 | 16 | public void bar() { 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/comments/HeaderBlock.cs.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Block comment header 3 | */ 4 | namespace comments 5 | { 6 | public class HeaderBlock 7 | { 8 | public virtual void foo() 9 | { 10 | } 11 | 12 | public virtual void bar() 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/test/resources/comments/HeaderBlock.java.txt: -------------------------------------------------------------------------------- 1 | /* 2 | * Block comment header 3 | */ 4 | package comments; 5 | 6 | public class HeaderBlock { 7 | public void foo() { 8 | } 9 | 10 | public void bar() { 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/disable/DisableClass.cs.txt: -------------------------------------------------------------------------------- 1 | #if !SILVERLIGHT 2 | namespace disable 3 | { 4 | public class DisableClass 5 | { 6 | private void foo() 7 | { 8 | } 9 | 10 | private void bar() 11 | { 12 | } 13 | } 14 | } 15 | #endif // !SILVERLIGHT -------------------------------------------------------------------------------- /src/test/resources/disable/DisableClass.java.txt: -------------------------------------------------------------------------------- 1 | package disable; 2 | 3 | /** 4 | * @sharpen.if !SILVERLIGHT 5 | */ 6 | public class DisableClass { 7 | 8 | private void foo() { 9 | } 10 | 11 | private void bar() { 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/disable/DisableCompilationUnit.cs.txt: -------------------------------------------------------------------------------- 1 | #if !SILVERLIGHT 2 | using System.Collections; 3 | 4 | namespace disable 5 | { 6 | internal class DisableClass 7 | { 8 | private void foo() 9 | { 10 | ArrayList arrayList = new ArrayList(); 11 | } 12 | 13 | private void bar() 14 | { 15 | } 16 | } 17 | } 18 | #endif // !SILVERLIGHT -------------------------------------------------------------------------------- /src/test/resources/disable/DisableCompilationUnit.java.txt: -------------------------------------------------------------------------------- 1 | /** 2 | * @sharpen.if !SILVERLIGHT 3 | */ 4 | package disable; 5 | 6 | import java.util.ArrayList; 7 | 8 | class DisableClass { 9 | 10 | private void foo() { 11 | ArrayList arrayList = new ArrayList(); 12 | } 13 | 14 | private void bar() { 15 | } 16 | } -------------------------------------------------------------------------------- /src/test/resources/disable/DisableInnerClass.cs.txt: -------------------------------------------------------------------------------- 1 | namespace disable 2 | { 3 | internal class OuterClass 4 | { 5 | private void foo() 6 | { 7 | } 8 | 9 | #if !SILVERLIGHT 10 | private class DisableInnerClass 11 | { 12 | private void bar() 13 | { 14 | } 15 | } 16 | #endif // !SILVERLIGHT 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/disable/DisableInnerClass.java.txt: -------------------------------------------------------------------------------- 1 | package disable; 2 | 3 | class OuterClass { 4 | 5 | private void foo() { 6 | } 7 | 8 | /** 9 | * @sharpen.if !SILVERLIGHT 10 | */ 11 | private static class DisableInnerClass { 12 | private void bar() { 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/disable/DisableMethod.cs.txt: -------------------------------------------------------------------------------- 1 | namespace disable 2 | { 3 | public class DisableMethod 4 | { 5 | #if !CF_1_0 6 | private void foo() 7 | { 8 | } 9 | #endif // !CF_1_0 10 | 11 | private void bar() 12 | { 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/disable/DisableMethod.java.txt: -------------------------------------------------------------------------------- 1 | package disable; 2 | 3 | public class DisableMethod { 4 | 5 | /** 6 | * @sharpen.if !CF_1_0 7 | */ 8 | private void foo() { 9 | } 10 | 11 | private void bar() { 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/disable/DisabledMethodInInterface.cs.txt: -------------------------------------------------------------------------------- 1 | namespace disable 2 | { 3 | internal interface DisableMethodInInterface 4 | { 5 | #if !CF_1_0 6 | void foo(); 7 | #endif // !CF_1_0 8 | 9 | void bar(); 10 | } 11 | 12 | internal abstract class ClassInTheMiddle : disable.DisableMethodInInterface 13 | { 14 | public abstract void bar(); 15 | 16 | #if !CF_1_0 17 | public abstract void foo(); 18 | #endif // !CF_1_0 19 | } 20 | 21 | internal class DisableMethodInInterfaceImplementer : disable.ClassInTheMiddle 22 | { 23 | public override void foo() 24 | { 25 | } 26 | 27 | public override void bar() 28 | { 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/test/resources/disable/DisabledMethodInInterface.java.txt: -------------------------------------------------------------------------------- 1 | package disable; 2 | 3 | interface DisableMethodInInterface { 4 | 5 | /** 6 | * @sharpen.if !CF_1_0 7 | */ 8 | public void foo(); 9 | 10 | public void bar(); 11 | } 12 | 13 | abstract class ClassInTheMiddle implements DisableMethodInInterface { 14 | } 15 | 16 | class DisableMethodInInterfaceImplementer extends ClassInTheMiddle { 17 | public void foo() { 18 | } 19 | 20 | public void bar() { 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/disable/NotSubjectToConditionalCompilation.cs.txt: -------------------------------------------------------------------------------- 1 | namespace disable 2 | { 3 | internal class IWillNotBeSubjectToConditionalCompilation 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/disable/NotSubjectToConditionalCompilation.java.txt: -------------------------------------------------------------------------------- 1 | package disable; 2 | 3 | class IWillNotBeSubjectToConditionalCompilation { 4 | } -------------------------------------------------------------------------------- /src/test/resources/disable/disabled/TypeSubjectToConditionalCompilation.cs.txt: -------------------------------------------------------------------------------- 1 | #if DisabledByConfig 2 | namespace disable.disabled 3 | { 4 | internal class IWillBeSubjectToConditionalCompilation 5 | { 6 | } 7 | } 8 | #endif // DisabledByConfig -------------------------------------------------------------------------------- /src/test/resources/disable/disabled/TypeSubjectToConditionalCompilation.java.txt: -------------------------------------------------------------------------------- 1 | package disable.disabled; 2 | 3 | class IWillBeSubjectToConditionalCompilation { 4 | } 5 | -------------------------------------------------------------------------------- /src/test/resources/disable/disabled/subpackage/TypesInSubPackagesShouldBeDisabledAlso.cs.txt: -------------------------------------------------------------------------------- 1 | #if DisabledByConfig 2 | namespace disable.disabled.subpackage 3 | { 4 | internal class TypesInSubPackagesShouldBeDisabledAlso 5 | { 6 | } 7 | } 8 | #endif // DisabledByConfig -------------------------------------------------------------------------------- /src/test/resources/disable/disabled/subpackage/TypesInSubPackagesShouldBeDisabledAlso.java.txt: -------------------------------------------------------------------------------- 1 | package disable.disabled.subpackage; 2 | 3 | class TypesInSubPackagesShouldBeDisabledAlso { 4 | } -------------------------------------------------------------------------------- /src/test/resources/events/EventInClassInterface.java.txt: -------------------------------------------------------------------------------- 1 | package events; 2 | 3 | interface EventRegistry { 4 | 5 | /** 6 | * An event. 7 | * 8 | * @sharpen.event QueryEventArgs 9 | */ 10 | public Object queryStarted(); 11 | 12 | /** 13 | * @sharpen.event QueryEventArgs 14 | */ 15 | public Object queryFinished(); 16 | 17 | } 18 | 19 | class EventRegistryImpl implements EventRegistry { 20 | 21 | private final Object _queryStarted = new Object(); 22 | 23 | private final Object _queryFinished = new Object(); 24 | 25 | public Object queryStarted() { 26 | return _queryStarted; 27 | } 28 | 29 | /** 30 | * @sharpen.event.onAdd onQueryFinishedListener 31 | */ 32 | public Object queryFinished() { 33 | return _queryFinished; 34 | } 35 | 36 | private void onQueryFinishedListener() { 37 | } 38 | } -------------------------------------------------------------------------------- /src/test/resources/events/EventInterface.cs.txt: -------------------------------------------------------------------------------- 1 | namespace events 2 | { 3 | public interface EventInterface 4 | { 5 | /// An event. 6 | event System.EventHandler QueryStarted; 7 | } 8 | } -------------------------------------------------------------------------------- /src/test/resources/events/EventInterface.java.txt: -------------------------------------------------------------------------------- 1 | package events; 2 | 3 | public interface EventInterface { 4 | 5 | /** 6 | * An event. 7 | * 8 | * @sharpen.event events.QueryEventArgs 9 | */ 10 | public Object queryStarted(); 11 | } -------------------------------------------------------------------------------- /src/test/resources/events/EventInterfaceImpl.cs.txt: -------------------------------------------------------------------------------- 1 | namespace events 2 | { 3 | public class EventInterfaceImpl : events.EventInterface 4 | { 5 | private System.EventHandler _queryStarted; 6 | 7 | public virtual event System.EventHandler QueryStarted 8 | { 9 | add 10 | { 11 | _queryStarted = (System.EventHandler)System.Delegate.Combine 12 | (_queryStarted, value); 13 | } 14 | remove 15 | { 16 | _queryStarted = (System.EventHandler)System.Delegate.Remove 17 | (_queryStarted, value); 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/test/resources/events/EventInterfaceImpl.java.txt: -------------------------------------------------------------------------------- 1 | package events; 2 | 3 | public class EventInterfaceImpl implements EventInterface { 4 | 5 | private Object _queryStarted; 6 | 7 | public Object queryStarted() { 8 | return _queryStarted; 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/events/EventMapping.java.txt: -------------------------------------------------------------------------------- 1 | package events; 2 | 3 | class EventConsumer { 4 | public static void main(final String[] cmdLine) { 5 | EventRegistry registry = eventRegistry(); 6 | registry.foo().addListener(new EventListener4() { 7 | public void onEvent(Event4 e, EventArgs args) { 8 | for (int i=0; i l2 = new ArrayList(); 13 | qualified(l2); 14 | } 15 | 16 | static void unqualified(Iterable iterable) { 17 | Iterator i = iterable.iterator(); 18 | } 19 | 20 | static void qualified(Iterable iterable) { 21 | Iterator i = iterable.iterator(); 22 | } 23 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericClass.cs.txt: -------------------------------------------------------------------------------- 1 | namespace generics 2 | { 3 | public class GenericClass 4 | { 5 | private T1 _field1; 6 | 7 | public GenericClass(T1 f1) 8 | { 9 | _field1 = f1; 10 | } 11 | 12 | public virtual T1 field1() 13 | { 14 | return _field1; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericClass.java.txt: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public class GenericClass { 4 | private T1 _field1; 5 | 6 | public GenericClass(T1 f1) { 7 | _field1 = f1; 8 | } 9 | 10 | public T1 field1() { 11 | return _field1; 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericExtends.cs.txt: -------------------------------------------------------------------------------- 1 | namespace generics 2 | { 3 | internal class GenericBase 4 | { 5 | } 6 | 7 | internal class GenericExtends : generics.GenericBase 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericExtends.java.txt: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | class GenericBase { 4 | } 5 | 6 | class GenericExtends extends GenericBase { 7 | } 8 | 9 | -------------------------------------------------------------------------------- /src/test/resources/generics/GenericImplements.cs.txt: -------------------------------------------------------------------------------- 1 | namespace generics 2 | { 3 | internal interface GenericInterface 4 | { 5 | } 6 | 7 | internal class GenericImplements : generics.GenericInterface 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericImplements.java.txt: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | interface GenericInterface { 4 | } 5 | 6 | class GenericImplements implements GenericInterface { 7 | } 8 | 9 | -------------------------------------------------------------------------------- /src/test/resources/generics/GenericInterface.cs.txt: -------------------------------------------------------------------------------- 1 | namespace generics 2 | { 3 | public interface GenericInterface 4 | { 5 | void foo(T value); 6 | 7 | T bar(); 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericInterface.java.txt: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public interface GenericInterface { 4 | void foo(T value); 5 | T bar(); 6 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericMethodImpl.cs.txt: -------------------------------------------------------------------------------- 1 | namespace generics 2 | { 3 | internal interface Map 4 | { 5 | V put(K key, V value); 6 | } 7 | 8 | internal abstract class MapImpl : generics.Map 9 | { 10 | public virtual V put(K key, V value) 11 | { 12 | return value; 13 | } 14 | } 15 | 16 | internal abstract class Hashtable : generics.Map 17 | { 18 | public virtual object put(object key, object value) 19 | { 20 | return value; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericMethodImpl.java.txt: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | interface Map { 4 | V put(K key, V value); 5 | } 6 | 7 | abstract class MapImpl implements Map { 8 | public V put(K key, V value) { 9 | return value; 10 | } 11 | } 12 | 13 | abstract class Hashtable implements Map { 14 | public Object put(Object key, Object value) { 15 | return value; 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericMethodParameters.cs.txt: -------------------------------------------------------------------------------- 1 | namespace generics 2 | { 3 | public class GenericMethodParameters 4 | { 5 | public interface Entry 6 | { 7 | } 8 | 9 | public virtual void entry(generics.GenericMethodParameters.Entry p1, 10 | generics.GenericMethodParameters.Entry p2) 11 | { 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericMethodParameters.java.txt: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public class GenericMethodParameters { 4 | 5 | public interface Entry { 6 | } 7 | 8 | public void entry(Entry p1, Entry p2) { 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericMethods.cs.txt: -------------------------------------------------------------------------------- 1 | namespace generics 2 | { 3 | public class GenericMethods 4 | { 5 | public virtual T[] toArray(T[] a) 6 | { 7 | return a; 8 | } 9 | 10 | public static System.Collections.Generic.IList asList() 11 | { 12 | return generics.GenericMethods.newList(); 13 | } 14 | 15 | private static System.Collections.Generic.IList newList() 16 | { 17 | return null; 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericMethods.java.txt: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | import java.util.*; 4 | 5 | public class GenericMethods { 6 | public T[] toArray(T[] a) { 7 | return a; 8 | } 9 | 10 | public static List asList() { 11 | return GenericMethods.newList(); 12 | } 13 | 14 | private static List newList() { 15 | return null; 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericObjectConstruction.cs.txt: -------------------------------------------------------------------------------- 1 | namespace generics 2 | { 3 | internal class Entry 4 | { 5 | } 6 | 7 | public class GenericObjectConstruction 8 | { 9 | private generics.Entry _default = new generics.Entry(); 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericObjectConstruction.java.txt: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | class Entry { 4 | } 5 | 6 | public class GenericObjectConstruction { 7 | private Entry _default = new Entry(); 8 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericReturnTypes.cs.txt: -------------------------------------------------------------------------------- 1 | namespace generics 2 | { 3 | public class GenericReturnTypes 4 | { 5 | public interface Entry 6 | { 7 | } 8 | 9 | public virtual generics.GenericReturnTypes.Entry entry() 10 | { 11 | return null; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericReturnTypes.java.txt: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | public class GenericReturnTypes { 4 | 5 | public interface Entry { 6 | } 7 | 8 | public Entry entry() { 9 | return null; 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericRuntimeTypeParameters.cs.txt: -------------------------------------------------------------------------------- 1 | namespace Generics 2 | { 3 | internal class GenericRuntimeTypeParameters 4 | { 5 | internal static System.Collections.Generic.IEnumerable Query() 6 | { 7 | System.Type clazz = typeof(T); 8 | Print(clazz.FullName); 9 | return null; 10 | } 11 | 12 | internal static void Test() 13 | { 14 | System.Collections.Generic.IEnumerable items = Query(); 15 | System.Type stringClass = typeof(string); 16 | System.Collections.IEnumerable items2 = Query(stringClass); 17 | } 18 | 19 | internal static void Print(string s) 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/test/resources/generics/GenericRuntimeTypeParameters.java.txt: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | import java.util.*; 4 | 5 | class GenericRuntimeTypeParameters { 6 | 7 | static Iterable query(Class clazz) { 8 | print(clazz.getName()); 9 | return null; 10 | } 11 | 12 | static void test() { 13 | Iterable items = query(String.class); 14 | Class stringClass = String.class; 15 | Iterable items2 = query(stringClass); 16 | } 17 | 18 | static void print(String s) { 19 | 20 | } 21 | } -------------------------------------------------------------------------------- /src/test/resources/generics/WildcardTypes.cs.txt: -------------------------------------------------------------------------------- 1 | namespace generics 2 | { 3 | internal class Item 4 | { 5 | } 6 | 7 | internal interface Foo 8 | { 9 | } 10 | 11 | public class WildcardTypes 12 | { 13 | private static void run<_T0>(generics.Foo<_T0> items) 14 | where _T0 : generics.Item 15 | { 16 | generics.Foo i = items; 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/resources/generics/WildcardTypes.java.txt: -------------------------------------------------------------------------------- 1 | package generics; 2 | 3 | class Item { 4 | } 5 | 6 | interface Foo { 7 | } 8 | 9 | public class WildcardTypes { 10 | private static void run(Foo items) { 11 | Foo i = items; 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/ignore/Ignore.java.txt: -------------------------------------------------------------------------------- 1 | package ignore; 2 | 3 | /** 4 | * @sharpen.ignore 5 | */ 6 | class Foo { 7 | } 8 | 9 | /** 10 | * @sharpen.ignore 11 | */ 12 | enum Bar { 13 | } -------------------------------------------------------------------------------- /src/test/resources/ignore/IgnoreAbstractMethod.cs.txt: -------------------------------------------------------------------------------- 1 | namespace ignore 2 | { 3 | internal interface IFoo 4 | { 5 | } 6 | 7 | internal abstract class IgnoreAbstractMethod : ignore.IFoo 8 | { 9 | public virtual void bar() 10 | { 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/ignore/IgnoreAbstractMethod.java.txt: -------------------------------------------------------------------------------- 1 | package ignore; 2 | 3 | interface IFoo { 4 | 5 | /** 6 | * @sharpen.ignore 7 | */ 8 | void baz(); 9 | } 10 | 11 | abstract class IgnoreAbstractMethod implements IFoo { 12 | 13 | public void bar() { 14 | } 15 | 16 | 17 | } -------------------------------------------------------------------------------- /src/test/resources/ignore/IgnoreExtends.cs.txt: -------------------------------------------------------------------------------- 1 | namespace ignore 2 | { 3 | public class IgnoreExtends : java.lang.Runnable 4 | { 5 | public virtual void run() 6 | { 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/ignore/IgnoreExtends.java.txt: -------------------------------------------------------------------------------- 1 | package ignore; 2 | 3 | /** 4 | * @sharpen.ignore.extends 5 | */ 6 | public class IgnoreExtends extends Object implements Runnable { 7 | public void run() { 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/ignore/IgnoreExtendsOverride.cs.txt: -------------------------------------------------------------------------------- 1 | namespace ignore 2 | { 3 | public class IgnoreExtendsOverride : java.lang.Runnable 4 | { 5 | internal abstract class Foo : java.io.Reader 6 | { 7 | public override void close() 8 | { 9 | } 10 | } 11 | 12 | public virtual void run() 13 | { 14 | } 15 | 16 | public virtual void close() 17 | { 18 | } 19 | 20 | public virtual void mark(int readAheadLimit) 21 | { 22 | } 23 | 24 | public virtual int read(char[] cbuf, int off, int len) 25 | { 26 | return 0; 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/test/resources/ignore/IgnoreExtendsOverride.java.txt: -------------------------------------------------------------------------------- 1 | package ignore; 2 | 3 | /** 4 | * @sharpen.ignore.extends 5 | */ 6 | public class IgnoreExtendsOverride extends java.io.Reader implements java.lang.Runnable { 7 | 8 | static abstract class Foo extends java.io.Reader { 9 | public void close() {} 10 | } 11 | 12 | public void run() {} 13 | public void close() {} 14 | public void mark(int readAheadLimit) {} 15 | public int read(char[] cbuf, int off, int len) { return 0; } 16 | } -------------------------------------------------------------------------------- /src/test/resources/ignore/IgnoreField.cs.txt: -------------------------------------------------------------------------------- 1 | namespace ignore 2 | { 3 | internal class Foo 4 | { 5 | public virtual void bar() 6 | { 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/ignore/IgnoreField.java.txt: -------------------------------------------------------------------------------- 1 | package ignore; 2 | 3 | class Foo { 4 | 5 | public void bar() { 6 | } 7 | 8 | /** 9 | * @sharpen.ignore 10 | */ 11 | public static final int answer = 42; 12 | } -------------------------------------------------------------------------------- /src/test/resources/ignore/IgnoreImplements.cs.txt: -------------------------------------------------------------------------------- 1 | namespace ignore 2 | { 3 | public class IgnoreImplements : object 4 | { 5 | public virtual void run() 6 | { 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/ignore/IgnoreImplements.java.txt: -------------------------------------------------------------------------------- 1 | package ignore; 2 | 3 | /** 4 | * @sharpen.ignore.implements 5 | */ 6 | public class IgnoreImplements extends Object implements Runnable { 7 | public void run() { 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/ignore/IgnoreMethod.cs.txt: -------------------------------------------------------------------------------- 1 | namespace ignore 2 | { 3 | internal class Foo 4 | { 5 | public virtual void bar() 6 | { 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/ignore/IgnoreMethod.java.txt: -------------------------------------------------------------------------------- 1 | package ignore; 2 | 3 | class Foo { 4 | 5 | public void bar() { 6 | } 7 | 8 | /** 9 | * @sharpen.ignore 10 | */ 11 | public void baz() { 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/imports/StaticImports.cs.txt: -------------------------------------------------------------------------------- 1 | namespace imports 2 | { 3 | internal class StaticImports 4 | { 5 | internal virtual void bar() 6 | { 7 | imports.StaticallyImported.foo(); 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/imports/StaticImports.java.txt: -------------------------------------------------------------------------------- 1 | package imports; 2 | 3 | import static imports.StaticallyImported.*; 4 | 5 | class StaticImports { 6 | 7 | void bar() { 8 | foo(); 9 | } 10 | 11 | } -------------------------------------------------------------------------------- /src/test/resources/imports/StaticallyImported.cs.txt: -------------------------------------------------------------------------------- 1 | namespace imports 2 | { 3 | internal class StaticallyImported 4 | { 5 | internal static int foo() 6 | { 7 | return 42; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/imports/StaticallyImported.java.txt: -------------------------------------------------------------------------------- 1 | package imports; 2 | 3 | class StaticallyImported { 4 | 5 | static int foo() { 6 | return 42; 7 | } 8 | 9 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass1.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class AnonymousInnerClass1 { 4 | public void start() { 5 | new Thread(new Runnable() { 6 | public void run() { 7 | print("Las Llamas son maiores que las ranas!"); 8 | } 9 | }); 10 | 11 | new Thread(new Runnable() { 12 | public void run() { 13 | ole(); 14 | } 15 | 16 | private void ole() { 17 | print("Ole!"); 18 | } 19 | }); 20 | } 21 | 22 | public void print(String msg) { 23 | } 24 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass10.cs.txt: -------------------------------------------------------------------------------- 1 | namespace innerclasses 2 | { 3 | internal class Base 4 | { 5 | public virtual void foo() 6 | { 7 | } 8 | } 9 | 10 | internal class AnonymousInnerClass10 11 | { 12 | public virtual void run() 13 | { 14 | innerclasses.Base b = new _Base_10(); 15 | } 16 | 17 | private sealed class _Base_10 : innerclasses.Base 18 | { 19 | public _Base_10() 20 | { 21 | } 22 | 23 | public override void foo() 24 | { 25 | } 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass10.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | class Base { 4 | public void foo() { 5 | } 6 | } 7 | 8 | class AnonymousInnerClass10 { 9 | public void run() { 10 | Base b = new Base() { 11 | public void foo() { 12 | } 13 | }; 14 | } 15 | } 16 | 17 | -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass11.cs.txt: -------------------------------------------------------------------------------- 1 | namespace innerclasses 2 | { 3 | internal class Base 4 | { 5 | public virtual void foo() 6 | { 7 | } 8 | } 9 | 10 | internal class AnonymousInnerClass10 11 | { 12 | private sealed class _Base_9 : innerclasses.Base 13 | { 14 | public _Base_9() 15 | { 16 | } 17 | 18 | public override void foo() 19 | { 20 | } 21 | } 22 | 23 | internal static innerclasses.Base b = new _Base_9(); 24 | } 25 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass11.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | class Base { 4 | public void foo() { 5 | } 6 | } 7 | 8 | class AnonymousInnerClass10 { 9 | static Base b = new Base() { 10 | public void foo() { 11 | } 12 | }; 13 | } 14 | 15 | -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass12.cs.txt: -------------------------------------------------------------------------------- 1 | namespace innerclasses 2 | { 3 | public class AnonymousInnerClass12 4 | { 5 | public virtual void run() 6 | { 7 | new java.lang.Thread(new _Runnable_6(this)); 8 | } 9 | 10 | private sealed class _Runnable_6 : java.lang.Runnable 11 | { 12 | public _Runnable_6(AnonymousInnerClass12 _enclosing) 13 | { 14 | this._enclosing = _enclosing; 15 | } 16 | 17 | public void run() 18 | { 19 | this._enclosing.print("Hello"); 20 | } 21 | 22 | private readonly AnonymousInnerClass12 _enclosing; 23 | } 24 | 25 | internal virtual void print(string msg) 26 | { 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass12.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class AnonymousInnerClass12 { 4 | 5 | public void run() { 6 | new Thread(new Runnable() { 7 | public void run() { 8 | AnonymousInnerClass12.this.print("Hello"); 9 | } 10 | }); 11 | } 12 | 13 | void print(String msg) { 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass13.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | abstract class Base implements Runnable { 4 | public Base(String arg) { 5 | } 6 | } 7 | 8 | class AnonymousInnerClass13 { 9 | 10 | private final String f = "foo"; 11 | 12 | public void run() { 13 | Base r = new Base("Hello") { 14 | public void run() { 15 | foo(); 16 | } 17 | }; 18 | 19 | r = new Base(f) { 20 | public void run() { 21 | } 22 | }; 23 | 24 | String s = "bar"; 25 | r = new Base(s) { 26 | public void run() { 27 | } 28 | }; 29 | 30 | r = new Base(null) { 31 | public void run() { 32 | } 33 | }; 34 | } 35 | 36 | private void foo() { 37 | } 38 | } 39 | 40 | -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass2.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class AnonymousInnerClass2 { 4 | public void start() { 5 | new Thread(new Runnable() { 6 | public void run() { 7 | new Thread(new Runnable() { 8 | public void run() { 9 | ole(); 10 | pock(); 11 | } 12 | 13 | private void pock() { 14 | print("POCK!"); 15 | } 16 | }); 17 | } 18 | 19 | private void ole() { 20 | print("Ole!"); 21 | } 22 | }); 23 | } 24 | 25 | public void print(String msg) { 26 | } 27 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass3.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class AnonymousInnerClass3 { 4 | 5 | private Printer _printer; 6 | 7 | public void start() { 8 | new Thread(new Runnable() { 9 | public void run() { 10 | new Thread(new Runnable() { 11 | public void run() { 12 | ole(); 13 | pock(); 14 | } 15 | 16 | private void pock() { 17 | _printer.print("POCK!"); 18 | } 19 | }); 20 | } 21 | 22 | private void ole() { 23 | _printer.print("Ole!"); 24 | } 25 | }); 26 | } 27 | } 28 | 29 | class Printer { 30 | public void print(String s) { 31 | } 32 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass4.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class AnonymousInnerClass4 { 4 | public void run() { 5 | new Thread(new Runnable() { 6 | public void run() { 7 | String a = "foo"; 8 | print(a + ": " + a.trim()); 9 | print(((Node)_root)._next._next.toString()); 10 | } 11 | }); 12 | } 13 | 14 | private void print(String a) { 15 | } 16 | 17 | Object _root; 18 | } 19 | 20 | class Node { 21 | 22 | public Node _next; 23 | 24 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass5.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class AnonymousInnerClass5 { 4 | public void run() { 5 | final String msg = "SPAM, SPAM, SPAM!"; 6 | new Thread(new Runnable() { 7 | public void run() { 8 | String a = "The message is: "; 9 | print(a + msg); 10 | print(((Node)_root)._next._next.toString()); 11 | } 12 | }); 13 | } 14 | 15 | private void print(String a) { 16 | } 17 | 18 | Object _root; 19 | } 20 | 21 | class Node { 22 | 23 | public Node _next; 24 | 25 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass6.cs.txt: -------------------------------------------------------------------------------- 1 | namespace innerclasses 2 | { 3 | public class AnonymousInnerClass6 4 | { 5 | private static string Message = "I'm lumberjack and I'm ok!"; 6 | 7 | public static void run() 8 | { 9 | new java.lang.Thread(new _Runnable_8()); 10 | } 11 | 12 | private sealed class _Runnable_8 : java.lang.Runnable 13 | { 14 | public _Runnable_8() 15 | { 16 | } 17 | 18 | public void run() 19 | { 20 | innerclasses.AnonymousInnerClass6.print(innerclasses.AnonymousInnerClass6.Message 21 | ); 22 | } 23 | } 24 | 25 | internal static void print(string msg) 26 | { 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass6.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class AnonymousInnerClass6 { 4 | 5 | private static String Message = "I'm lumberjack and I'm ok!"; 6 | 7 | public static void run() { 8 | new Thread(new Runnable() { 9 | public void run() { 10 | print(Message); 11 | } 12 | }); 13 | } 14 | 15 | static void print(String msg) { 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass7.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class AnonymousInnerClass7 { 4 | public void run() { 5 | final String msg = "SPAM, SPAM, SPAM!"; 6 | new Thread(new Runnable() { 7 | public void run() { 8 | execute("what? "); 9 | } 10 | 11 | private void execute(String prefix) { 12 | print(prefix + msg); 13 | print(((Node)_root)._next._next.toString()); 14 | } 15 | }); 16 | } 17 | 18 | private void print(String a) { 19 | } 20 | 21 | Object _root; 22 | } 23 | 24 | class Node { 25 | 26 | public Node _next; 27 | 28 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass8.cs.txt: -------------------------------------------------------------------------------- 1 | namespace innerclasses 2 | { 3 | internal class Base 4 | { 5 | public virtual void foo() 6 | { 7 | } 8 | } 9 | 10 | internal class AnonymousInnerClass8 : innerclasses.Base 11 | { 12 | public virtual void run() 13 | { 14 | java.lang.Runnable r = new _Runnable_10(this); 15 | } 16 | 17 | private sealed class _Runnable_10 : java.lang.Runnable 18 | { 19 | public _Runnable_10(AnonymousInnerClass8 _enclosing) 20 | { 21 | this._enclosing = _enclosing; 22 | } 23 | 24 | public void run() 25 | { 26 | this._enclosing.foo(); 27 | } 28 | 29 | private readonly AnonymousInnerClass8 _enclosing; 30 | } 31 | } 32 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass8.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | class Base { 4 | public void foo() { 5 | } 6 | } 7 | 8 | class AnonymousInnerClass8 extends Base { 9 | public void run() { 10 | Runnable r = new Runnable() { 11 | public void run() { 12 | foo(); 13 | } 14 | }; 15 | } 16 | } 17 | 18 | -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousInnerClass9.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class AnonymousInnerClass9 { 4 | 5 | public void start() { 6 | final int a = 0; 7 | new Thread(new Runnable() { 8 | public void run() { 9 | new Thread(new Runnable() { 10 | public void run() { 11 | use(a); 12 | this.foo(); 13 | } 14 | private void foo() { 15 | } 16 | }); 17 | } 18 | }); 19 | } 20 | 21 | public void use(int i) { 22 | } 23 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousWithFinalField.cs.txt: -------------------------------------------------------------------------------- 1 | namespace innerclasses 2 | { 3 | public class AnonymousWithFinalField 4 | { 5 | public static java.lang.Comparable run(object obj) 6 | { 7 | return new _Comparable_5(obj); 8 | } 9 | 10 | private sealed class _Comparable_5 : java.lang.Comparable 11 | { 12 | public _Comparable_5(object obj) 13 | { 14 | this.obj = obj; 15 | this._source = ((int)obj); 16 | } 17 | 18 | private readonly int _source; 19 | 20 | public int compareTo(object target) 21 | { 22 | return this._source - ((int)target); 23 | } 24 | 25 | private readonly object obj; 26 | } 27 | } 28 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/AnonymousWithFinalField.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class AnonymousWithFinalField { 4 | public static Comparable run(final Object obj) { 5 | return new Comparable() { 6 | private final int _source = ((Integer)obj).intValue(); 7 | public int compareTo(Object target) { 8 | return _source - ((Integer)target).intValue(); 9 | } 10 | }; 11 | } 12 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/GenericAnonymousWithAdditionalMethods.cs.txt: -------------------------------------------------------------------------------- 1 | namespace innerclasses 2 | { 3 | public class GenericAnonymousWithAdditionalMethods 4 | { 5 | public static java.lang.Comparable run(object obj) 6 | { 7 | return new _Comparable_5(); 8 | } 9 | 10 | private sealed class _Comparable_5 : java.lang.Comparable 11 | { 12 | public _Comparable_5() 13 | { 14 | } 15 | 16 | public int compareTo(object target) 17 | { 18 | return this.result(target); 19 | } 20 | 21 | /* 22 | For some unknown reason in MappingsImpl#isDeclaringClassIgnoringExtends() declaringClassBinding believes it is non anonymous. 23 | I can see, people don't like to be anonymous (at least most of the time). 24 | */ 25 | private int result(object target) 26 | { 27 | return 0; 28 | } 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/GenericAnonymousWithAdditionalMethods.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class GenericAnonymousWithAdditionalMethods { 4 | public static Comparable run(final Object obj) { 5 | return new Comparable() { 6 | public int compareTo(Object target) { 7 | return result(target); 8 | } 9 | 10 | /* 11 | For some unknown reason in MappingsImpl#isDeclaringClassIgnoringExtends() declaringClassBinding believes it is non anonymous. 12 | I can see, people don't like to be anonymous (at least most of the time). 13 | */ 14 | private int result(Object target) { 15 | return 0; 16 | } 17 | }; 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/InnerClassInFieldInitializer.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | class Class1 { 4 | private Runnable _runnable = new Runnable() { 5 | public void run() { 6 | _field ++; 7 | } 8 | }; 9 | 10 | private int _field = 0; 11 | } 12 | 13 | class Class2 { 14 | 15 | private Runnable _r1 = new Runnable() { 16 | public void run() { 17 | _field++; 18 | } 19 | }; 20 | 21 | private Runnable _r2 = new Runnable() { 22 | public void run() { 23 | _field--; 24 | } 25 | }; 26 | 27 | private int _field = 0; 28 | 29 | private Runnable _r3 = _r1; 30 | 31 | private Runnable _r4 = null; 32 | 33 | public Class2(int initialValue) { 34 | _field = initialValue; 35 | } 36 | 37 | public Class2() { 38 | } 39 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/NestedClass1.cs.txt: -------------------------------------------------------------------------------- 1 | namespace innerclasses 2 | { 3 | public class NestedClass1 4 | { 5 | public class Foo 6 | { 7 | public virtual void foo() 8 | { 9 | this._enclosing.bar(); 10 | } 11 | 12 | internal Foo(NestedClass1 _enclosing) 13 | { 14 | this._enclosing = _enclosing; 15 | } 16 | 17 | private readonly NestedClass1 _enclosing; 18 | } 19 | 20 | public virtual void bar() 21 | { 22 | } 23 | 24 | public virtual void run() 25 | { 26 | new innerclasses.NestedClass1.Foo(this).foo(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/NestedClass1.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class NestedClass1 { 4 | public class Foo { 5 | public void foo() { 6 | bar(); 7 | } 8 | } 9 | 10 | public void bar() { 11 | } 12 | 13 | public void run() { 14 | new Foo().foo(); 15 | } 16 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/NestedClass2.cs.txt: -------------------------------------------------------------------------------- 1 | namespace innerclasses 2 | { 3 | public class NestedClass2 4 | { 5 | public class Foo 6 | { 7 | public Foo(NestedClass2 _enclosing, int i) 8 | { 9 | this._enclosing = _enclosing; 10 | } 11 | 12 | public virtual void foo() 13 | { 14 | this._enclosing.bar(); 15 | } 16 | 17 | private readonly NestedClass2 _enclosing; 18 | } 19 | 20 | public virtual void bar() 21 | { 22 | } 23 | 24 | public virtual void run() 25 | { 26 | new innerclasses.NestedClass2.Foo(this, 42).foo(); 27 | } 28 | } 29 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/NestedClass2.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class NestedClass2 { 4 | public class Foo { 5 | public Foo(int i) { 6 | } 7 | public void foo() { 8 | bar(); 9 | } 10 | } 11 | 12 | public void bar() { 13 | } 14 | 15 | public void run() { 16 | new Foo(42).foo(); 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/NestedStaticClass1.cs.txt: -------------------------------------------------------------------------------- 1 | namespace innerclasses 2 | { 3 | public class NestedStaticClass1 4 | { 5 | public class Foo 6 | { 7 | public virtual void foo() 8 | { 9 | } 10 | } 11 | 12 | public virtual void bar() 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/NestedStaticClass1.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class NestedStaticClass1 { 4 | public static class Foo { 5 | public void foo() { 6 | } 7 | } 8 | 9 | public void bar() { 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/innerclasses/NestedThis.java.txt: -------------------------------------------------------------------------------- 1 | package innerclasses; 2 | 3 | public class NestedThis { 4 | 5 | public static class Env { 6 | 7 | public Object get(Object key) { 8 | return null; 9 | } 10 | 11 | public Env add(final Object key, final Object value) { 12 | return new Env() { 13 | public Object get(Object key1) { 14 | if (key == key1) { 15 | return value; 16 | } 17 | return Env.this.get(key); 18 | } 19 | }; 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/integration/namespaceMapping/bar/FooUsage.cs.txt: -------------------------------------------------------------------------------- 1 | using UbberFoo; 2 | 3 | namespace integration.namespaceMapping.bar 4 | { 5 | internal class FooUsage 6 | { 7 | internal FooFactory foo = new FooFactory(); 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/integration/namespaceMapping/bar/FooUsage.java.txt: -------------------------------------------------------------------------------- 1 | package integration.namespaceMapping.bar; 2 | 3 | import integration.namespaceMapping.foo.*; 4 | 5 | class FooUsage { 6 | 7 | Foo foo = new Foo(); 8 | } -------------------------------------------------------------------------------- /src/test/resources/integration/namespaceMapping/foo/Foo.cs.txt: -------------------------------------------------------------------------------- 1 | namespace UbberFoo 2 | { 3 | public class FooFactory 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/integration/namespaceMapping/foo/Foo.java.txt: -------------------------------------------------------------------------------- 1 | package integration.namespaceMapping.foo; 2 | 3 | /** 4 | * @sharpen.rename FooFactory 5 | */ 6 | public class Foo { 7 | } -------------------------------------------------------------------------------- /src/test/resources/interfaces/BaseFoo.cs.txt: -------------------------------------------------------------------------------- 1 | namespace Interfaces 2 | { 3 | public class BaseFoo : Interfaces.IFoo 4 | { 5 | public const int Bar = 42; 6 | } 7 | 8 | internal interface IFoo 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/interfaces/BaseFoo.java.txt: -------------------------------------------------------------------------------- 1 | package interfaces; 2 | 3 | public class BaseFoo implements Foo { 4 | public static final int BAR = 42; 5 | } 6 | 7 | interface Foo { 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/interfaces/DiamondImpl.cs.txt: -------------------------------------------------------------------------------- 1 | namespace Interfaces 2 | { 3 | internal interface IDiamondA 4 | { 5 | int DiamondFoo(); 6 | } 7 | 8 | internal interface IDiamondB 9 | { 10 | int DiamondFoo(); 11 | } 12 | 13 | internal abstract class DiamondImpl : Interfaces.IDiamondA, Interfaces.IDiamondB 14 | { 15 | public abstract int DiamondFoo(); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/interfaces/DiamondImpl.java.txt: -------------------------------------------------------------------------------- 1 | package interfaces; 2 | 3 | interface DiamondA { 4 | int diamondFoo(); 5 | } 6 | 7 | interface DiamondB { 8 | int diamondFoo(); 9 | } 10 | abstract class DiamondImpl implements DiamondA, DiamondB { 11 | } -------------------------------------------------------------------------------- /src/test/resources/interfaces/Foo.java.txt: -------------------------------------------------------------------------------- 1 | package interfaces; 2 | 3 | public interface Foo { 4 | void bar(); 5 | } 6 | 7 | class Baz implements Foo { 8 | 9 | public void bar() { 10 | } 11 | } 12 | 13 | class Gazonk { 14 | 15 | public void quux(Foo f) { 16 | f.bar(); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/interfaces/FooImpl.cs.txt: -------------------------------------------------------------------------------- 1 | namespace Interfaces 2 | { 3 | /// 4 | /// See 5 | /// 6 | /// 7 | public class FooImpl : Interfaces.IFoo 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/interfaces/FooImpl.java.txt: -------------------------------------------------------------------------------- 1 | package interfaces; 2 | 3 | /** 4 | * See {@link interfaces.BaseFoo#BAR} 5 | */ 6 | public class FooImpl implements Foo { 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/interfaces/IFoo.cs.txt: -------------------------------------------------------------------------------- 1 | namespace Interfaces 2 | { 3 | public interface IFoo 4 | { 5 | void Bar(); 6 | } 7 | 8 | internal class Baz : Interfaces.IFoo 9 | { 10 | public virtual void Bar() 11 | { 12 | } 13 | } 14 | 15 | internal class Gazonk 16 | { 17 | public virtual void Quux(Interfaces.IFoo f) 18 | { 19 | f.Bar(); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /src/test/resources/interfaces/MappedBaseFoo.cs.txt: -------------------------------------------------------------------------------- 1 | namespace What.Ever 2 | { 3 | public class MappedBaseFoo : What.Ever.IFoo 4 | { 5 | } 6 | 7 | internal interface IFoo 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/interfaces/MappedBaseFoo.java.txt: -------------------------------------------------------------------------------- 1 | package interfaces; 2 | 3 | public class MappedBaseFoo implements Foo { 4 | } 5 | 6 | interface Foo { 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/interfaces/MappedFooImpl.cs.txt: -------------------------------------------------------------------------------- 1 | namespace What.Ever 2 | { 3 | public class MappedFooImpl : What.Ever.IFoo 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/interfaces/MappedFooImpl.java.txt: -------------------------------------------------------------------------------- 1 | package interfaces; 2 | 3 | public class MappedFooImpl implements Foo { 4 | } 5 | -------------------------------------------------------------------------------- /src/test/resources/interfaces/other/Other.java.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/sharpen/0a539c4e6ab58c462baf3b999c1f4a53b6fa113e/src/test/resources/interfaces/other/Other.java.txt -------------------------------------------------------------------------------- /src/test/resources/javadoc/GenericTypeReference.cs.txt: -------------------------------------------------------------------------------- 1 | namespace javadoc 2 | { 3 | /// 4 | /// 5 | /// 6 | /// 7 | internal class GenericTypeReference 8 | { 9 | } 10 | 11 | internal class Item 12 | { 13 | public T value; 14 | 15 | public virtual void foo() 16 | { 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/resources/javadoc/GenericTypeReference.java.txt: -------------------------------------------------------------------------------- 1 | package javadoc; 2 | 3 | /** 4 | * {@link Item} 5 | * {@link Item#foo} 6 | * 7 | */ 8 | class GenericTypeReference { 9 | } 10 | 11 | class Item { 12 | public T value; 13 | 14 | public void foo() { 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/javadoc/PropertyParamTag.cs.txt: -------------------------------------------------------------------------------- 1 | namespace javadoc 2 | { 3 | internal class PropertyParamTag 4 | { 5 | /// the argument 6 | public virtual int foo 7 | { 8 | set 9 | { 10 | int v = value; 11 | } 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/javadoc/PropertyParamTag.java.txt: -------------------------------------------------------------------------------- 1 | package javadoc; 2 | 3 | class PropertyParamTag { 4 | /** 5 | * @param v the argument 6 | * 7 | * @sharpen.property 8 | */ 9 | public void foo(int v) { 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/javadoc/javadoc.IEventInterface.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | This was overlaid here. 6 | 7 | And this is the IEventInterface. 8 | 9 | 10 | 11 | 12 | 13 | 14 | A query started. 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /src/test/resources/macro/MethodMacro.cs.txt: -------------------------------------------------------------------------------- 1 | namespace macro 2 | { 3 | internal class Event4Impl 4 | { 5 | public virtual void trigger(object args) 6 | { 7 | } 8 | } 9 | 10 | internal class Program 11 | { 12 | internal static void run() 13 | { 14 | macro.Event4Impl e = new macro.Event4Impl(); 15 | if (null != e) e(null, "foo"); 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/macro/MethodMacro.java.txt: -------------------------------------------------------------------------------- 1 | package macro; 2 | 3 | class Event4Impl { 4 | 5 | /** 6 | * @sharpen.macro if (null != $expression) $expression(null, $arguments) 7 | */ 8 | public void trigger(Object args) { 9 | } 10 | } 11 | 12 | class Program { 13 | static void run() { 14 | Event4Impl e = new Event4Impl(); 15 | e.trigger("foo"); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /src/test/resources/macro/TypeMacro.cs.txt: -------------------------------------------------------------------------------- 1 | namespace macro 2 | { 3 | internal class TypeMacro 4 | { 5 | internal System.EventHandler _field; 6 | 7 | internal virtual void foo(System.EventHandler parameter) 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/macro/TypeMacro.java.txt: -------------------------------------------------------------------------------- 1 | package macro; 2 | 3 | /** 4 | * @sharpen.macro System.EventHandler<$T1> 5 | * @sharpen.ignore 6 | */ 7 | class TypeWithMacro { 8 | } 9 | 10 | class TypeMacro { 11 | 12 | TypeWithMacro _field; 13 | 14 | void foo(TypeWithMacro parameter) { 15 | } 16 | } -------------------------------------------------------------------------------- /src/test/resources/mappings/RemovedConstructor.cs.txt: -------------------------------------------------------------------------------- 1 | namespace mappings 2 | { 3 | internal class Foo 4 | { 5 | public Foo(int value) 6 | { 7 | } 8 | } 9 | 10 | internal class RemovedConstructor 11 | { 12 | public virtual void run() 13 | { 14 | bar(42); 15 | } 16 | 17 | private void bar(object o) 18 | { 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/test/resources/mappings/RemovedConstructor.java.txt: -------------------------------------------------------------------------------- 1 | package mappings; 2 | 3 | class Foo { 4 | public Foo(int value) { 5 | } 6 | } 7 | 8 | class RemovedConstructor { 9 | 10 | public void run() { 11 | bar(new Foo(42)); 12 | } 13 | 14 | private void bar(Object o) { 15 | } 16 | 17 | } -------------------------------------------------------------------------------- /src/test/resources/modifiers/New.cs.txt: -------------------------------------------------------------------------------- 1 | namespace modifiers 2 | { 3 | internal class Base 4 | { 5 | public virtual void foo() 6 | { 7 | } 8 | 9 | public virtual void bar() 10 | { 11 | } 12 | 13 | public int fooBar; 14 | } 15 | 16 | internal abstract class Derived : modifiers.Base 17 | { 18 | new public int foo; 19 | 20 | new public void bar() 21 | { 22 | // As of today, this will be translated incorrectly to C# (which requires the "base" keyword to qualify fooBar) 23 | // but if you write code like this you deserve it :) 24 | fooBar = 42; 25 | } 26 | 27 | new public abstract void fooBar(); 28 | } 29 | } -------------------------------------------------------------------------------- /src/test/resources/modifiers/New.java.txt: -------------------------------------------------------------------------------- 1 | package modifiers; 2 | 3 | class Base { 4 | 5 | public void foo() { 6 | } 7 | 8 | public void bar() { 9 | } 10 | 11 | public int fooBar; 12 | } 13 | 14 | abstract class Derived extends Base { 15 | 16 | /** @sharpen.new */ 17 | public int foo; 18 | 19 | /** @sharpen.new */ 20 | public void bar() { 21 | 22 | // As of today, this will be translated incorrectly to C# (which requires the "base" keyword to qualify fooBar) 23 | // but if you write code like this you deserve it :) 24 | fooBar = 42; 25 | } 26 | 27 | /** @sharpen.new */ 28 | public abstract void fooBar(); 29 | } -------------------------------------------------------------------------------- /src/test/resources/modifiers/Override1.cs.txt: -------------------------------------------------------------------------------- 1 | namespace modifiers 2 | { 3 | internal class Override1Base 4 | { 5 | public virtual void foo() 6 | { 7 | } 8 | } 9 | 10 | internal class Override1 : modifiers.Override1Base 11 | { 12 | public override void foo() 13 | { 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/test/resources/modifiers/Override1.java.txt: -------------------------------------------------------------------------------- 1 | package modifiers; 2 | 3 | class Override1Base { 4 | 5 | public void foo() { 6 | } 7 | } 8 | 9 | class Override1 extends Override1Base { 10 | 11 | public void foo() { 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/modifiers/Override2.cs.txt: -------------------------------------------------------------------------------- 1 | namespace modifiers 2 | { 3 | internal class BaseClass 4 | { 5 | public virtual void foo() 6 | { 7 | } 8 | } 9 | 10 | internal class DerivedClass : modifiers.BaseClass 11 | { 12 | } 13 | 14 | internal class MostDerivedClass : modifiers.DerivedClass 15 | { 16 | public override void foo() 17 | { 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/test/resources/modifiers/Override2.java.txt: -------------------------------------------------------------------------------- 1 | package modifiers; 2 | 3 | class BaseClass { 4 | public void foo() { 5 | } 6 | } 7 | 8 | class DerivedClass extends BaseClass { 9 | } 10 | 11 | class MostDerivedClass extends DerivedClass { 12 | 13 | public void foo() { 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/modifiers/Override3.cs.txt: -------------------------------------------------------------------------------- 1 | namespace modifiers 2 | { 3 | internal interface Foo 4 | { 5 | void foo(); 6 | } 7 | 8 | internal interface Bar : modifiers.Foo 9 | { 10 | } 11 | 12 | internal abstract class FooImpl1 : modifiers.Bar 13 | { 14 | public abstract void foo(); 15 | } 16 | 17 | internal class FooImpl2 : modifiers.FooImpl1 18 | { 19 | public override void foo() 20 | { 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/test/resources/modifiers/Override3.java.txt: -------------------------------------------------------------------------------- 1 | package modifiers; 2 | 3 | interface Foo { 4 | void foo(); 5 | } 6 | 7 | interface Bar extends Foo { 8 | } 9 | 10 | abstract class FooImpl1 implements Bar { 11 | } 12 | 13 | class FooImpl2 extends FooImpl1 { 14 | public void foo() { 15 | } 16 | } -------------------------------------------------------------------------------- /src/test/resources/modifiers/Override4.cs.txt: -------------------------------------------------------------------------------- 1 | namespace modifiers 2 | { 3 | internal class YapField 4 | { 5 | internal virtual void delete() 6 | { 7 | } 8 | } 9 | 10 | internal abstract class YapFieldVirtual : modifiers.YapField 11 | { 12 | internal abstract override void delete(); 13 | } 14 | 15 | internal class YapFieldVersion : modifiers.YapFieldVirtual 16 | { 17 | internal override void delete() 18 | { 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/test/resources/modifiers/Override4.java.txt: -------------------------------------------------------------------------------- 1 | package modifiers; 2 | 3 | class YapField { 4 | 5 | void delete() { 6 | } 7 | } 8 | 9 | abstract class YapFieldVirtual extends YapField { 10 | 11 | abstract void delete(); 12 | } 13 | 14 | class YapFieldVersion extends YapFieldVirtual { 15 | 16 | void delete() { 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/modifiers/VirtualMethod1.cs.txt: -------------------------------------------------------------------------------- 1 | namespace modifiers 2 | { 3 | public class VirtualMethod1 4 | { 5 | public virtual void foo() 6 | { 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/modifiers/VirtualMethod1.java.txt: -------------------------------------------------------------------------------- 1 | package modifiers; 2 | 3 | public class VirtualMethod1 { 4 | public void foo() { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/mp/Albatross.cs.txt: -------------------------------------------------------------------------------- 1 | namespace mp 2 | { 3 | public class Albatross 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/mp/Albatross.java.txt: -------------------------------------------------------------------------------- 1 | package mp; 2 | 3 | public class Albatross { 4 | } -------------------------------------------------------------------------------- /src/test/resources/mp/BaseType1.cs.txt: -------------------------------------------------------------------------------- 1 | namespace mp 2 | { 3 | internal class BaseType 4 | { 5 | } 6 | 7 | internal class FinalType : mp.BaseType 8 | { 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/mp/BaseType1.java.txt: -------------------------------------------------------------------------------- 1 | package mp; 2 | 3 | class BaseType { 4 | } 5 | 6 | class FinalType extends BaseType { 7 | } -------------------------------------------------------------------------------- /src/test/resources/mp/nested/Parrot.cs.txt: -------------------------------------------------------------------------------- 1 | namespace mp.nested 2 | { 3 | public class Parrot 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/mp/nested/Parrot.java.txt: -------------------------------------------------------------------------------- 1 | package mp.nested; 2 | 3 | public class Parrot { 4 | } -------------------------------------------------------------------------------- /src/test/resources/namespaceMapping/foo/bar/Baz.cs.txt: -------------------------------------------------------------------------------- 1 | namespace NamespaceMapping.Foo.Bar 2 | { 3 | public class Baz 4 | { 5 | public void Bar(byte b, short s, int i, long j, char c, float f, double d) 6 | { 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/namespaceMapping/foo/bar/Baz.java.txt: -------------------------------------------------------------------------------- 1 | package namespaceMapping.foo.bar; 2 | 3 | public class Baz { 4 | public final void bar(byte b, short s, int i, long j, char c, float f, double d) { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/namespaceMapping/foo/bar/Gazonk.cs.txt: -------------------------------------------------------------------------------- 1 | namespace NamespaceMapping.Foo.Bar 2 | { 3 | public class Gazonk 4 | { 5 | internal virtual NamespaceMapping.Foo.Bar.Baz GetBaz() 6 | { 7 | return null; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/namespaceMapping/foo/bar/Gazonk.java.txt: -------------------------------------------------------------------------------- 1 | package namespaceMapping.foo.bar; 2 | 3 | public class Gazonk { 4 | Baz getBaz() { 5 | return null; 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/namespaceMapping/out/event/Foo.cs.txt: -------------------------------------------------------------------------------- 1 | namespace namespaceMapping.@out.@event 2 | { 3 | public class Foo 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/namespaceMapping/out/event/Foo.java.txt: -------------------------------------------------------------------------------- 1 | package namespaceMapping.out.event; 2 | 3 | public class Foo { 4 | } -------------------------------------------------------------------------------- /src/test/resources/nativeTypeSystem/Reflection.cs.txt: -------------------------------------------------------------------------------- 1 | namespace NativeTypeSystem 2 | { 3 | public class Reflection 4 | { 5 | /// 6 | public virtual void InvokeMethod(System.Reflection.MethodInfo m, object[] args) 7 | { 8 | m.Invoke(null, args); 9 | } 10 | 11 | public virtual string DeclaringType(System.Reflection.MethodInfo m) 12 | { 13 | return m.DeclaringType.FullName; 14 | } 15 | } 16 | } -------------------------------------------------------------------------------- /src/test/resources/nativeTypeSystem/Reflection.java.txt: -------------------------------------------------------------------------------- 1 | package nativeTypeSystem; 2 | 3 | import java.lang.reflect.*; 4 | 5 | public class Reflection { 6 | public void invokeMethod(Method m, Object[] args) throws Exception { 7 | m.setAccessible(true); 8 | m.invoke(null, args); 9 | } 10 | 11 | public String declaringType(Method m) { 12 | return m.getDeclaringClass().getName(); 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/nativeTypeSystem/StringMethods1.cs.txt: -------------------------------------------------------------------------------- 1 | namespace nativeTypeSystem 2 | { 3 | public class StringMethods1 4 | { 5 | public static void run(string s) 6 | { 7 | print(42.ToString()); 8 | print((43 - 1).ToString()); 9 | } 10 | 11 | private static void print(string s) 12 | { 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/nativeTypeSystem/StringMethods1.java.txt: -------------------------------------------------------------------------------- 1 | package nativeTypeSystem; 2 | 3 | public class StringMethods1 { 4 | public static void run(String s) { 5 | print(String.valueOf(42)); 6 | print(String.valueOf(43-1)); 7 | } 8 | 9 | private static void print(String s) { 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/problems/Spam.cs.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mono/sharpen/0a539c4e6ab58c462baf3b999c1f4a53b6fa113e/src/test/resources/problems/Spam.cs.txt -------------------------------------------------------------------------------- /src/test/resources/problems/Spam.java.txt: -------------------------------------------------------------------------------- 1 | package problems; 2 | 3 | public class Spam { 4 | Eggs getEggs() { 5 | return null; 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/properties/BaseInterfaceGetter.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | public abstract class BaseInterfaceGetter : properties.InterfaceGetter 4 | { 5 | public abstract bool IsCancelled 6 | { 7 | get; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/properties/BaseInterfaceGetter.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | public abstract class BaseInterfaceGetter implements InterfaceGetter { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /src/test/resources/properties/BaseInterfaceGetterImpl.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | public class BaseInterfaceGetterImpl : properties.BaseInterfaceGetter 4 | { 5 | public override bool IsCancelled 6 | { 7 | get 8 | { 9 | return false; 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/properties/BaseInterfaceGetterImpl.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | public class BaseInterfaceGetterImpl extends BaseInterfaceGetter { 4 | 5 | public boolean isCancelled() { 6 | return false; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/properties/GetterSetterWithDifferentNames.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | internal class SimpleGetterSetter 4 | { 5 | private int _value; 6 | 7 | internal virtual int Value 8 | { 9 | get 10 | { 11 | return _value; 12 | } 13 | set 14 | { 15 | _value = value; 16 | } 17 | } 18 | } 19 | 20 | internal class SimpleSetter 21 | { 22 | public virtual bool IsCancelled 23 | { 24 | set 25 | { 26 | System.Console.Out.WriteLine(value); 27 | } 28 | } 29 | } 30 | 31 | internal class Client 32 | { 33 | internal static void Run(properties.SimpleGetterSetter sgs) 34 | { 35 | sgs.Value = 42; 36 | System.Console.Out.WriteLine(sgs.Value); 37 | } 38 | } 39 | } -------------------------------------------------------------------------------- /src/test/resources/properties/GetterSetterWithDifferentNames.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | class SimpleGetterSetter { 4 | 5 | private int _value; 6 | 7 | /** 8 | * @sharpen.property Value 9 | */ 10 | void set(int value) { 11 | _value = value; 12 | } 13 | 14 | /** 15 | * @sharpen.property Value 16 | */ 17 | int get() { 18 | return _value; 19 | } 20 | 21 | } 22 | 23 | class SimpleSetter { 24 | /** 25 | * @sharpen.property IsCancelled 26 | */ 27 | public void setCancel(boolean value) { 28 | System.out.println(value); 29 | } 30 | } 31 | 32 | class Client { 33 | static void run(SimpleGetterSetter sgs) { 34 | sgs.set(42); 35 | System.out.println(sgs.get()); 36 | } 37 | } -------------------------------------------------------------------------------- /src/test/resources/properties/InterfaceGetter.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | public interface InterfaceGetter 4 | { 5 | bool IsCancelled 6 | { 7 | get; 8 | } 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/properties/InterfaceGetter.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | public interface InterfaceGetter { 4 | 5 | /** 6 | * @sharpen.property 7 | */ 8 | public boolean isCancelled(); 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/properties/InterfaceGetterImpl.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | public class InterfaceGetterImpl : properties.InterfaceGetter 4 | { 5 | public virtual bool IsCancelled 6 | { 7 | get 8 | { 9 | return false; 10 | } 11 | } 12 | 13 | public static bool Foo(properties.InterfaceGetter getter) 14 | { 15 | return getter.IsCancelled; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/properties/InterfaceGetterImpl.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | public class InterfaceGetterImpl implements InterfaceGetter { 4 | 5 | public boolean isCancelled() { 6 | return false; 7 | } 8 | 9 | public static boolean foo(InterfaceGetter getter) { 10 | return getter.isCancelled(); 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/properties/InterfaceSetter.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | public interface InterfaceSetter { 4 | 5 | /** 6 | * @sharpen.property 7 | */ 8 | public void isCancelled(boolean value); 9 | 10 | } -------------------------------------------------------------------------------- /src/test/resources/properties/MappedProperties.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | internal class CustomIterator : System.Collections.IEnumerator 4 | { 5 | public virtual bool MoveNext() 6 | { 7 | return false; 8 | } 9 | 10 | public virtual object Current 11 | { 12 | get 13 | { 14 | return null; 15 | } 16 | } 17 | 18 | public virtual void Remove() 19 | { 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/properties/MappedProperties.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | class CustomIterator implements java.util.Iterator { 4 | 5 | public boolean hasNext() { 6 | return false; 7 | } 8 | 9 | public Object next() { 10 | return null; 11 | } 12 | 13 | public void remove() { 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/properties/NonStaticNestedUsingSuperProperty.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | internal class Foo 4 | { 5 | private class Bar : properties.InterfaceGetterImpl 6 | { 7 | public virtual void Run() 8 | { 9 | if (this.IsCancelled) 10 | { 11 | return; 12 | } 13 | } 14 | 15 | internal Bar(Foo _enclosing) 16 | { 17 | this._enclosing = _enclosing; 18 | } 19 | 20 | private readonly Foo _enclosing; 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /src/test/resources/properties/NonStaticNestedUsingSuperProperty.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | class Foo { 4 | 5 | private class Bar extends InterfaceGetterImpl { 6 | public void run() { 7 | if (isCancelled()) { 8 | return; 9 | } 10 | } 11 | } 12 | 13 | } -------------------------------------------------------------------------------- /src/test/resources/properties/OverrideGetter.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | public class OverrideGetter : properties.InterfaceGetterImpl 4 | { 5 | public override bool IsCancelled 6 | { 7 | get 8 | { 9 | return base.IsCancelled; 10 | } 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/properties/OverrideGetter.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | public class OverrideGetter extends InterfaceGetterImpl { 4 | 5 | public boolean isCancelled() { 6 | return super.isCancelled(); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/properties/OverrideGetterConsumer.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | internal abstract class Blah 4 | { 5 | public abstract void Foo(); 6 | } 7 | 8 | public class OverrideGetterConsumer 9 | { 10 | public static void Foo() 11 | { 12 | properties.OverrideGetter og = new properties.OverrideGetter(); 13 | new _Blah_12(og); 14 | } 15 | 16 | private sealed class _Blah_12 : properties.Blah 17 | { 18 | public _Blah_12(properties.OverrideGetter og) 19 | { 20 | this.og = og; 21 | } 22 | 23 | public override void Foo() 24 | { 25 | og.IsCancelled; 26 | } 27 | 28 | private readonly properties.OverrideGetter og; 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /src/test/resources/properties/OverrideGetterConsumer.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | abstract class Blah { 4 | 5 | public abstract void foo(); 6 | } 7 | 8 | public class OverrideGetterConsumer { 9 | 10 | public static void foo() { 11 | final OverrideGetter og = new OverrideGetter(); 12 | new Blah() { 13 | public void foo() { 14 | og.isCancelled(); 15 | } 16 | }; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /src/test/resources/properties/SimpleGetter.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | public class SimpleGetter 4 | { 5 | public bool IsCancelled 6 | { 7 | get 8 | { 9 | return false; 10 | } 11 | } 12 | 13 | public virtual void Foo() 14 | { 15 | if (IsCancelled) 16 | { 17 | return; 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/test/resources/properties/SimpleGetter.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | public class SimpleGetter { 4 | 5 | /** 6 | * @sharpen.property 7 | */ 8 | public final boolean isCancelled() { 9 | return false; 10 | } 11 | 12 | public void foo() { 13 | if (isCancelled()) { 14 | return; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/properties/SimpleSetter.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | public class SimpleSetter 4 | { 5 | public bool IsCancelled 6 | { 7 | set 8 | { 9 | } 10 | } 11 | 12 | public bool Cancelled 13 | { 14 | set 15 | { 16 | bool c = value; 17 | IsCancelled = c; 18 | } 19 | } 20 | 21 | public virtual void Foo() 22 | { 23 | IsCancelled = true; 24 | } 25 | } 26 | } -------------------------------------------------------------------------------- /src/test/resources/properties/SimpleSetter.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | public class SimpleSetter { 4 | 5 | /** 6 | * @sharpen.property 7 | */ 8 | public final void isCancelled(boolean value) { 9 | } 10 | 11 | /** 12 | * @sharpen.property 13 | */ 14 | public final void cancelled(boolean c) { 15 | isCancelled(c); 16 | } 17 | 18 | public void foo() { 19 | isCancelled(true); 20 | } 21 | } -------------------------------------------------------------------------------- /src/test/resources/properties/StaticGetter.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | public class StaticGetter 4 | { 5 | public static bool IsCancelled 6 | { 7 | get 8 | { 9 | return false; 10 | } 11 | } 12 | 13 | public static void Foo() 14 | { 15 | if (properties.StaticGetter.IsCancelled) 16 | { 17 | return; 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/test/resources/properties/StaticGetter.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | public class StaticGetter { 4 | 5 | /** 6 | * @sharpen.property 7 | */ 8 | public static boolean isCancelled() { 9 | return false; 10 | } 11 | 12 | public static void foo() { 13 | if (StaticGetter.isCancelled()) { 14 | return; 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/properties/TestIndexer.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | public class TestIndexer 4 | { 5 | public static void Main(string[] args) 6 | { 7 | int j = new properties.TestIndexer()[1]; 8 | properties.TestIndexer ti = new properties.TestIndexer(); 9 | j = ti[2]; 10 | } 11 | 12 | public virtual int this[int i] 13 | { 14 | get 15 | { 16 | return i; 17 | } 18 | } 19 | 20 | public virtual void Test(int i) 21 | { 22 | if (i != this[i]) 23 | { 24 | } 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /src/test/resources/properties/TestIndexer.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | public class TestIndexer { 4 | public static void main(String[] args) { 5 | int j = new TestIndexer().getIt(1); 6 | TestIndexer ti = new TestIndexer(); 7 | j = ti.getIt(2); 8 | } 9 | 10 | /** 11 | * @sharpen.indexer 12 | */ 13 | public int getIt(int i) { 14 | return i; 15 | } 16 | 17 | public void test(int i) { 18 | if (i != getIt(i)) { 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/test/resources/properties/TestIndexerClient.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | public class TestIndexerClient 4 | { 5 | public virtual void UseIt() 6 | { 7 | properties.TestIndexer ti = new properties.TestIndexer(); 8 | int j = ti[7]; 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/properties/TestIndexerClient.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | public class TestIndexerClient { 4 | public void useIt() { 5 | TestIndexer ti = new TestIndexer(); 6 | int j = ti.getIt(7); 7 | } 8 | } -------------------------------------------------------------------------------- /src/test/resources/properties/TestIndexerGeneric.cs.txt: -------------------------------------------------------------------------------- 1 | namespace properties 2 | { 3 | public class TestIndexerGeneric 4 | { 5 | public static void Main(string[] args) 6 | { 7 | int j = new properties.TestIndexerGeneric()[1]; 8 | properties.TestIndexerGeneric ti = new properties.TestIndexerGeneric(); 10 | string v = ti[4]; 11 | } 12 | 13 | public virtual E this[int i] 14 | { 15 | get 16 | { 17 | return null; 18 | } 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /src/test/resources/properties/TestIndexerGeneric.java.txt: -------------------------------------------------------------------------------- 1 | package properties; 2 | 3 | public class TestIndexerGeneric { 4 | public static void main(String[] args) { 5 | int j = new TestIndexerGeneric().getIt(1); 6 | TestIndexerGeneric ti = new TestIndexerGeneric(); 7 | String v = ti.getIt(4); 8 | } 9 | 10 | /** 11 | * @sharpen.indexer 12 | */ 13 | public E getIt(int i) { 14 | return null; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /src/test/resources/remove/RemoveAllClassesInArray.cs.txt: -------------------------------------------------------------------------------- 1 | namespace remove 2 | { 3 | internal class RemoveAllClassesInArray 4 | { 5 | internal static System.Type[] classes = new System.Type[] { }; 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/remove/RemoveAllClassesInArray.java.txt: -------------------------------------------------------------------------------- 1 | package remove; 2 | 3 | /** 4 | * @sharpen.remove 5 | */ 6 | class RemovedClassOne { 7 | } 8 | 9 | /** 10 | * @sharpen.remove 11 | */ 12 | class RemovedClassTwo { 13 | } 14 | 15 | class RemoveAllClassesInArray { 16 | static Class[] classes = { RemovedClassOne.class, RemovedClassTwo.class, }; 17 | } -------------------------------------------------------------------------------- /src/test/resources/remove/RemoveClass.cs.txt: -------------------------------------------------------------------------------- 1 | namespace remove 2 | { 3 | internal class ReferencesRemovedClass 4 | { 5 | internal static System.Type[] classes = new System.Type[] { typeof(string) }; 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/remove/RemoveClass.java.txt: -------------------------------------------------------------------------------- 1 | package remove; 2 | 3 | /** 4 | * @sharpen.remove 5 | */ 6 | class RemovedClass { 7 | } 8 | 9 | class ReferencesRemovedClass { 10 | static Class[] classes = { RemovedClass.class, String.class, RemovedClass.class }; 11 | } -------------------------------------------------------------------------------- /src/test/resources/remove/RemoveFirst.cs.txt: -------------------------------------------------------------------------------- 1 | namespace remove 2 | { 3 | internal class Foo 4 | { 5 | public virtual void baz(int i) 6 | { 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/remove/RemoveFirst.java.txt: -------------------------------------------------------------------------------- 1 | package remove; 2 | 3 | class Foo { 4 | 5 | /** 6 | * @sharpen.remove.first 7 | */ 8 | public void baz(int i) { 9 | i = i + 1; 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/remove/RemoveFirstInConstructor.cs.txt: -------------------------------------------------------------------------------- 1 | namespace remove 2 | { 3 | internal class Foo 4 | { 5 | public Foo(int i) 6 | { 7 | System.Console.Out.WriteLine(i); 8 | } 9 | } 10 | 11 | internal class Bar : remove.Foo 12 | { 13 | public Bar() 14 | { 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/remove/RemoveFirstInConstructor.java.txt: -------------------------------------------------------------------------------- 1 | package remove; 2 | 3 | class Foo { 4 | 5 | public Foo(int i) { 6 | System.out.println(i); 7 | } 8 | } 9 | 10 | class Bar extends Foo { 11 | /** 12 | * @sharpen.remove.first 13 | */ 14 | public Bar() { 15 | super(10); 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/remove/RemoveMethod.cs.txt: -------------------------------------------------------------------------------- 1 | namespace remove 2 | { 3 | internal class Foo 4 | { 5 | public virtual void bar() 6 | { 7 | zeng("before"); 8 | zeng("after"); 9 | } 10 | 11 | public virtual void zeng(string s) 12 | { 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/remove/RemoveMethod.java.txt: -------------------------------------------------------------------------------- 1 | package remove; 2 | 3 | class Foo { 4 | 5 | public void bar() { 6 | zeng("before"); 7 | baz(); 8 | zeng("after"); 9 | 10 | } 11 | 12 | /** 13 | * @sharpen.remove 14 | */ 15 | public void baz() { 16 | } 17 | 18 | public void zeng(String s) { 19 | } 20 | } -------------------------------------------------------------------------------- /src/test/resources/remove/RemoveMethodByConfig.cs.txt: -------------------------------------------------------------------------------- 1 | namespace remove 2 | { 3 | internal class Foo 4 | { 5 | public virtual void bar() 6 | { 7 | zeng("before"); 8 | zeng("after"); 9 | } 10 | 11 | public virtual void zeng(string s) 12 | { 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/remove/RemoveMethodByConfig.java.txt: -------------------------------------------------------------------------------- 1 | package remove; 2 | 3 | class Foo { 4 | 5 | public void bar() { 6 | zeng("before"); 7 | baz(); 8 | zeng("after"); 9 | 10 | } 11 | 12 | public void baz() { 13 | } 14 | 15 | public void zeng(String s) { 16 | } 17 | } -------------------------------------------------------------------------------- /src/test/resources/remove/RemoveMethodInExpression.cs.txt: -------------------------------------------------------------------------------- 1 | namespace remove 2 | { 3 | internal class Foo 4 | { 5 | public virtual void bar() 6 | { 7 | zeng("before"); 8 | if (false) 9 | { 10 | zeng("after"); 11 | } 12 | bool b = false == true; 13 | } 14 | 15 | public virtual void zeng(string s) 16 | { 17 | } 18 | } 19 | } -------------------------------------------------------------------------------- /src/test/resources/remove/RemoveMethodInExpression.java.txt: -------------------------------------------------------------------------------- 1 | package remove; 2 | 3 | class Foo { 4 | public void bar() { 5 | zeng("before"); 6 | if (baz()) { 7 | zeng("after"); 8 | } 9 | 10 | boolean b = baz() == true; 11 | } 12 | 13 | /** 14 | * @sharpen.remove false 15 | */ 16 | public boolean baz() { 17 | return true; 18 | } 19 | 20 | public void zeng(String s) { 21 | } 22 | } -------------------------------------------------------------------------------- /src/test/resources/renaming/AllUpperCaseIdentifiers.cs.txt: -------------------------------------------------------------------------------- 1 | namespace Renaming 2 | { 3 | public class AllUpperCaseIdentifiers 4 | { 5 | /// 6 | public readonly object Foo = null; 7 | 8 | public readonly object FooBar = null; 9 | } 10 | } -------------------------------------------------------------------------------- /src/test/resources/renaming/AllUpperCaseIdentifiers.java.txt: -------------------------------------------------------------------------------- 1 | package renaming; 2 | 3 | public class AllUpperCaseIdentifiers { 4 | /** 5 | * {@link AllUpperCaseIdentifiers#FOO_BAR} 6 | */ 7 | public final Object FOO = null; 8 | public final Object FOO_BAR = null; 9 | } -------------------------------------------------------------------------------- /src/test/resources/renaming/Renamed.cs.txt: -------------------------------------------------------------------------------- 1 | namespace renaming 2 | { 3 | public class Renamed 4 | { 5 | public Renamed() 6 | { 7 | } 8 | 9 | public virtual Renamed foo(object o) 10 | { 11 | return (Renamed)o; 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/renaming/RenamingInTypeHierarchy.cs.txt: -------------------------------------------------------------------------------- 1 | namespace Renaming 2 | { 3 | public class RenamingInTypeHierarchy 4 | { 5 | public virtual void Bar() 6 | { 7 | } 8 | 9 | public virtual void OverridenInDerived() 10 | { 11 | } 12 | } 13 | 14 | internal class RenameDerived 15 | { 16 | public virtual void Baz() 17 | { 18 | } 19 | } 20 | } -------------------------------------------------------------------------------- /src/test/resources/renaming/RenamingInTypeHierarchy.java.txt: -------------------------------------------------------------------------------- 1 | package renaming; 2 | 3 | public class RenamingInTypeHierarchy { 4 | /** 5 | * @sharpen.rename bar 6 | */ 7 | public void foo(){ 8 | } 9 | 10 | public void overridenInDerived() { 11 | } 12 | } 13 | 14 | /** 15 | * @sharpen.ignore.extends 16 | */ 17 | class RenameDerived extends RenamingInTypeHierarchy { 18 | /** 19 | * @sharpen.rename baz 20 | */ 21 | public void overridenInDerived() { 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /src/test/resources/renaming/SimpleMethodRenaming.cs.txt: -------------------------------------------------------------------------------- 1 | namespace renaming 2 | { 3 | internal class SimpleMethodRenaming 4 | { 5 | public virtual void _test() 6 | { 7 | } 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/renaming/SimpleMethodRenaming.java.txt: -------------------------------------------------------------------------------- 1 | package renaming; 2 | 3 | class SimpleMethodRenaming { 4 | /** 5 | * @sharpen.rename _test 6 | */ 7 | public void test() { 8 | } 9 | } -------------------------------------------------------------------------------- /src/test/resources/renaming/TypeRenaming.java.txt: -------------------------------------------------------------------------------- 1 | package renaming; 2 | 3 | /** 4 | * @sharpen.rename Renamed 5 | */ 6 | public class TypeRenaming { 7 | 8 | public TypeRenaming() { 9 | } 10 | 11 | public TypeRenaming foo(Object o) { 12 | return (TypeRenaming)o; 13 | } 14 | } -------------------------------------------------------------------------------- /src/test/resources/replace/ReplaceExtends.cs.txt: -------------------------------------------------------------------------------- 1 | namespace replace 2 | { 3 | public class ReplaceExtends : Replaced, replace.TestInterface 4 | { 5 | public virtual void run() 6 | { 7 | } 8 | } 9 | 10 | internal interface TestInterface 11 | { 12 | } 13 | } -------------------------------------------------------------------------------- /src/test/resources/replace/ReplaceExtends.java.txt: -------------------------------------------------------------------------------- 1 | package replace; 2 | 3 | /** 4 | * @sharpen.extends Replaced 5 | */ 6 | public class ReplaceExtends extends Object implements TestInterface { 7 | public void run() { 8 | } 9 | } 10 | 11 | interface TestInterface { 12 | } -------------------------------------------------------------------------------- /src/test/resources/resources/header.txt: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2007 */ 2 | -------------------------------------------------------------------------------- /src/test/resources/resources/options: -------------------------------------------------------------------------------- 1 | -methodMapping Foo.foo Foo.bar 2 | 3 | -namespaceMapping spam eggs -------------------------------------------------------------------------------- /src/test/resources/structs/Struct1.cs.txt: -------------------------------------------------------------------------------- 1 | namespace structs 2 | { 3 | public struct Struct1 4 | { 5 | public string name; 6 | 7 | public void foo() 8 | { 9 | } 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/structs/Struct1.java.txt: -------------------------------------------------------------------------------- 1 | package structs; 2 | 3 | /** 4 | * @sharpen.struct 5 | */ 6 | public class Struct1 { 7 | public String name; 8 | 9 | public void foo() { 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/unwrap/Unwrap.cs.txt: -------------------------------------------------------------------------------- 1 | namespace unwrap 2 | { 3 | internal class Unwrap 4 | { 5 | internal static string to_s(object o) 6 | { 7 | return o.ToString(); 8 | } 9 | 10 | internal static object apply(object o) 11 | { 12 | return o; 13 | } 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/unwrap/Unwrap.java.txt: -------------------------------------------------------------------------------- 1 | package unwrap; 2 | 3 | class Unwrap { 4 | 5 | /** 6 | * @sharpen.unwrap 7 | */ 8 | static String to_s(Object o) { 9 | return o.toString(); 10 | } 11 | 12 | static Object apply(Object o) { 13 | return to_s(o); 14 | } 15 | } -------------------------------------------------------------------------------- /src/test/resources/usings/FullyQualifiedType.cs.txt: -------------------------------------------------------------------------------- 1 | namespace Usings 2 | { 3 | internal class Test 4 | { 5 | internal static void Foo() 6 | { 7 | } 8 | 9 | internal class SubTest 10 | { 11 | } 12 | } 13 | 14 | public class FullyQualifiedType 15 | { 16 | private Usings.Test _test; 17 | 18 | private Usings.Test.SubTest _subTest; 19 | 20 | internal virtual void Bar() 21 | { 22 | Usings.Test.Foo(); 23 | } 24 | } 25 | } -------------------------------------------------------------------------------- /src/test/resources/usings/FullyQualifiedType.java.txt: -------------------------------------------------------------------------------- 1 | package usings; 2 | 3 | class Test { 4 | 5 | static void foo(){ 6 | } 7 | 8 | static class SubTest { 9 | } 10 | } 11 | 12 | public class FullyQualifiedType { 13 | private Test _test; 14 | private Test.SubTest _subTest; 15 | 16 | void bar(){ 17 | Test.foo(); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/resources/usings/Generics.cs.txt: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | 4 | namespace Usings 5 | { 6 | public class Generics 7 | { 8 | internal static void Run() 9 | { 10 | IDictionary m = new Dictionary(); 11 | foreach (KeyValuePair e in m) 12 | { 13 | Print(e.Key); 14 | Print(e.Value); 15 | } 16 | Type klass = m.GetType(); 17 | Print(klass); 18 | } 19 | 20 | internal static void Print(object o) 21 | { 22 | } 23 | } 24 | } -------------------------------------------------------------------------------- /src/test/resources/usings/Generics.java.txt: -------------------------------------------------------------------------------- 1 | package usings; 2 | 3 | import java.util.*; 4 | 5 | public class Generics { 6 | static void run() { 7 | Map m = new HashMap(); 8 | for (Map.Entry e : m.entrySet()) { 9 | print(e.getKey()); 10 | print(e.getValue()); 11 | } 12 | Class klass = m.getClass(); 13 | print(klass); 14 | } 15 | 16 | static void print(Object o) { 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/usings/MethodNameConflict.cs.txt: -------------------------------------------------------------------------------- 1 | namespace Usings 2 | { 3 | internal class Usings 4 | { 5 | } 6 | 7 | public class MethodNameConflict 8 | { 9 | public virtual void Usings() 10 | { 11 | Usings.Usings u = new Usings.Usings(); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /src/test/resources/usings/MethodNameConflict.java.txt: -------------------------------------------------------------------------------- 1 | package usings; 2 | 3 | class Usings { 4 | } 5 | 6 | public class MethodNameConflict { 7 | 8 | public void usings() { 9 | Usings u = new Usings(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/usings/NamespaceConflict.cs.txt: -------------------------------------------------------------------------------- 1 | namespace Usings 2 | { 3 | internal class Usings 4 | { 5 | } 6 | 7 | public class NamespaceConflict 8 | { 9 | private Usings.Usings _test; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/resources/usings/NamespaceConflict.java.txt: -------------------------------------------------------------------------------- 1 | package usings; 2 | 3 | class Usings { 4 | } 5 | 6 | public class NamespaceConflict { 7 | private Usings _test; 8 | } 9 | -------------------------------------------------------------------------------- /src/test/resources/usings/SimpleTest.cs.txt: -------------------------------------------------------------------------------- 1 | namespace Usings 2 | { 3 | public class SimpleTest 4 | { 5 | private SimpleTest _test; 6 | } 7 | } -------------------------------------------------------------------------------- /src/test/resources/usings/SimpleTest.java.txt: -------------------------------------------------------------------------------- 1 | package usings; 2 | 3 | public class SimpleTest { 4 | 5 | private SimpleTest _test; 6 | } 7 | -------------------------------------------------------------------------------- /src/test/resources/usings/deep/tree/InnerStaticClass.cs.txt: -------------------------------------------------------------------------------- 1 | namespace Usings.Deep.Tree 2 | { 3 | public sealed class InnerStaticClass 4 | { 5 | public class FirstLevel 6 | { 7 | public class SecondLevel 8 | { 9 | public static string Message = "Opps!"; 10 | } 11 | } 12 | 13 | public void Test() 14 | { 15 | string msg = InnerStaticClass.FirstLevel.SecondLevel.Message; 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /src/test/resources/usings/deep/tree/InnerStaticClass.java.txt: -------------------------------------------------------------------------------- 1 | package usings.deep.tree; 2 | 3 | public final class InnerStaticClass { 4 | public static class FirstLevel { 5 | public static class SecondLevel { 6 | public static String MESSAGE = "Opps!"; 7 | } 8 | } 9 | 10 | public void test() { 11 | String msg = InnerStaticClass.FirstLevel.SecondLevel.MESSAGE; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /src/test/resources/usings/deep/tree/NestedType.cs.txt: -------------------------------------------------------------------------------- 1 | namespace Usings.Deep.Tree 2 | { 3 | public class NestedType 4 | { 5 | private class Test 6 | { 7 | } 8 | 9 | private NestedType.Test[] _tests; 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/usings/deep/tree/NestedType.java.txt: -------------------------------------------------------------------------------- 1 | package usings.deep.tree; 2 | 3 | public class NestedType { 4 | 5 | private static class Test { 6 | } 7 | 8 | private Test[] _tests; 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/visibility/Internal.cs.txt: -------------------------------------------------------------------------------- 1 | namespace visibility 2 | { 3 | internal class Internal 4 | { 5 | } 6 | } -------------------------------------------------------------------------------- /src/test/resources/visibility/Internal.java.txt: -------------------------------------------------------------------------------- 1 | package visibility; 2 | 3 | /** 4 | * @sharpen.internal 5 | */ 6 | public class Internal { 7 | } -------------------------------------------------------------------------------- /src/test/resources/visibility/Private.cs.txt: -------------------------------------------------------------------------------- 1 | namespace visibility 2 | { 3 | public class Private 4 | { 5 | private int _field; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /src/test/resources/visibility/Private.java.txt: -------------------------------------------------------------------------------- 1 | package visibility; 2 | 3 | public class Private { 4 | 5 | /** 6 | * @sharpen.private 7 | */ 8 | public int _field; 9 | } 10 | -------------------------------------------------------------------------------- /src/test/resources/visibility/Public.cs.txt: -------------------------------------------------------------------------------- 1 | namespace visibility 2 | { 3 | public class Public 4 | { 5 | public int _field; 6 | } 7 | 8 | public class PackagePrivate 9 | { 10 | } 11 | } -------------------------------------------------------------------------------- /src/test/resources/visibility/Public.java.txt: -------------------------------------------------------------------------------- 1 | package visibility; 2 | 3 | public class Public { 4 | 5 | /** 6 | * @sharpen.public 7 | */ 8 | private int _field; 9 | } 10 | 11 | /** @sharpen.public */ 12 | class PackagePrivate { 13 | } 14 | -------------------------------------------------------------------------------- /src/test/sharpen/ui/tests/ArraysTestCase.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010 Versant Inc. http://www.db4o.com */ 2 | 3 | package sharpen.ui.tests; 4 | import org.junit.Test; 5 | 6 | public class ArraysTestCase extends AbstractConversionTestCase { 7 | @Test 8 | public void testArrayAccess() throws Throwable { 9 | runResourceTestCase("Arrays1"); 10 | } 11 | @Test 12 | public void testArrayCreation() throws Throwable { 13 | runResourceTestCase("Arrays2"); 14 | } 15 | @Test 16 | public void testArrayInitializer() throws Throwable { 17 | runResourceTestCase("Arrays3"); 18 | } 19 | @Test 20 | public void testNestedArrayInitializer() throws Throwable { 21 | runResourceTestCase("Arrays4"); 22 | } 23 | @Test 24 | public void testUntypedArrayInitializer() throws Throwable { 25 | runResourceTestCase("Arrays5"); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /src/test/sharpen/ui/tests/AttributesTestCase.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010 Versant Inc. http://www.db4o.com */ 2 | 3 | package sharpen.ui.tests; 4 | import org.junit.Test; 5 | 6 | public class AttributesTestCase extends AbstractConversionTestCase { 7 | @Test 8 | public void testAttributes() throws Throwable { 9 | runResourceTestCase("Attributes"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /src/test/sharpen/ui/tests/ConstructorsTestCase.java: -------------------------------------------------------------------------------- 1 | package sharpen.ui.tests; 2 | import org.junit.Test; 3 | 4 | public class ConstructorsTestCase extends AbstractConversionTestCase { 5 | @Test 6 | public void testConstructorDeclaration() throws Throwable { 7 | runResourceTestCase("Constructors1"); 8 | } 9 | 10 | @Test 11 | public void testConstructorInvocationFromConstructor() throws Throwable { 12 | runResourceTestCase("Constructors2"); 13 | } 14 | 15 | @Test 16 | public void testInitializers() throws Throwable { 17 | runResourceTestCase("Initializers"); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /src/test/sharpen/ui/tests/ImportsTestCase.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 - 2010 Versant Inc. http://www.db4o.com */ 2 | 3 | package sharpen.ui.tests; 4 | import org.junit.Test; 5 | 6 | 7 | public class ImportsTestCase extends AbstractConversionTestCase { 8 | @Test 9 | public void testStaticImports() throws Throwable { 10 | runBatchConverterTestCase(getConfiguration(), "imports/StaticImports", "imports/StaticallyImported"); 11 | } 12 | 13 | 14 | } 15 | -------------------------------------------------------------------------------- /src/test/sharpen/ui/tests/LabelsTestCase.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2004 - 2010 Versant Inc. http://www.db4o.com */ 2 | 3 | package sharpen.ui.tests; 4 | import org.junit.Test; 5 | 6 | public class LabelsTestCase extends AbstractConversionTestCase { 7 | @Test 8 | public void test() throws Throwable{ 9 | runResourceTestCase("Labels"); 10 | } 11 | 12 | } 13 | -------------------------------------------------------------------------------- /src/test/sharpen/ui/tests/MacroConversionTestCase.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2009 Versant Inc. http://www.db4o.com */ 2 | 3 | package sharpen.ui.tests; 4 | import org.junit.Test; 5 | 6 | public class MacroConversionTestCase extends AbstractConversionTestCase { 7 | @Test 8 | public void testMethodMacro() throws Throwable { 9 | runResourceTestCase("macro/MethodMacro"); 10 | } 11 | @Test 12 | public void testTypeMacro() throws Throwable { 13 | runResourceTestCase("macro/TypeMacro"); 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /src/test/sharpen/ui/tests/MappingsTestCase.java: -------------------------------------------------------------------------------- 1 | package sharpen.ui.tests; 2 | 3 | import sharpen.core.*; 4 | import org.junit.Test; 5 | 6 | public class MappingsTestCase extends AbstractConversionTestCase { 7 | 8 | @Test 9 | public void testRemovedConstructor() throws Throwable { 10 | runResourceTestCase("mappings/RemovedConstructor"); 11 | } 12 | 13 | @Override 14 | protected Configuration getConfiguration() { 15 | final Configuration config = super.getConfiguration(); 16 | config.mapMethod("mappings.Foo.Foo", ""); 17 | return config; 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /src/test/sharpen/ui/tests/VisibilityTestCase.java: -------------------------------------------------------------------------------- 1 | /* Copyright (C) 2010 Versant Inc. http://www.db4o.com */ 2 | 3 | package sharpen.ui.tests; 4 | import org.junit.Test; 5 | 6 | public class VisibilityTestCase extends AbstractConversionTestCase { 7 | 8 | @Test 9 | public void testInternal() throws Throwable { 10 | runResourceTestCase("visibility/Internal"); 11 | } 12 | 13 | @Test 14 | public void testSharpenPublic() throws Throwable { 15 | runResourceTestCase("visibility/Public"); 16 | } 17 | @Test 18 | public void testSharpenPrivate() throws Throwable { 19 | runResourceTestCase("visibility/Private"); 20 | } 21 | 22 | } 23 | -------------------------------------------------------------------------------- /src/test/sharpen/ui/tests/configuration/CustomConfiguration.java: -------------------------------------------------------------------------------- 1 | package sharpen.ui.tests.configuration; 2 | 3 | import sharpen.core.Configuration; 4 | 5 | public class CustomConfiguration extends Configuration { 6 | 7 | public CustomConfiguration(String runtimeTypeName) { 8 | super(runtimeTypeName); 9 | } 10 | 11 | @Override 12 | public boolean isIgnoredExceptionType(String exceptionType) { 13 | return false; 14 | } 15 | 16 | @Override 17 | public boolean mapByteToSbyte() { 18 | return false; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /src/test/sharpen/util/InputStreamUtility.java: -------------------------------------------------------------------------------- 1 | package sharpen.util; 2 | 3 | 4 | import java.io.*; 5 | 6 | public class InputStreamUtility { 7 | 8 | public static String readString(java.io.InputStream stream) 9 | throws IOException { 10 | return readString(new InputStreamReader(stream)); 11 | } 12 | 13 | public static String readString(InputStream stream, String charset) 14 | throws IOException { 15 | return readString(new InputStreamReader(stream, charset)); 16 | } 17 | 18 | public static String readString(InputStreamReader reader) 19 | throws IOException { 20 | 21 | final BufferedReader bufferedReader = new BufferedReader(reader); 22 | final StringWriter writer = new StringWriter(); 23 | String line = null; 24 | while (null != (line = bufferedReader.readLine())) { 25 | writer.write(line); 26 | writer.write("\n"); 27 | } 28 | return writer.toString(); 29 | } 30 | } -------------------------------------------------------------------------------- /src/test/sharpen/util/ResourceLoader.java: -------------------------------------------------------------------------------- 1 | package sharpen.util; 2 | 3 | 4 | import java.io.*; 5 | 6 | 7 | public class ResourceLoader { 8 | 9 | public static String getStringContents(final Class anchor, String resourceName) throws IOException { 10 | InputStream stream = anchor.getResourceAsStream(resourceName); 11 | if (null == stream) ResourceLoader.resourceNotFound(resourceName); 12 | try { 13 | return InputStreamUtility.readString(stream); 14 | } finally { 15 | stream.close(); 16 | } 17 | } 18 | 19 | public static void resourceNotFound(String resourceName) { 20 | throw new IllegalArgumentException("Resource '" + resourceName + "' not found"); 21 | } 22 | 23 | } 24 | -------------------------------------------------------------------------------- /travis/before_install.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #set version from travis_tag if it found 3 | if [[ $TRAVIS_TAG =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+)?$ ]]; then 4 | echo "Setting build version from tag $TRAVIS_TAG!" 5 | myVer=$(echo $TRAVIS_TAG | sed -e s/^v//) 6 | mvn versions:set "-DnewVersion=$myVer" 7 | fi 8 | mvn install -q -DskipTests=true -DfinalName=sharpen --------------------------------------------------------------------------------