diff --git a/Directory.Build.props b/Directory.Build.props index 6b328f1f9..8aa75e7b4 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -62,7 +62,7 @@ 11 11 <_BootClassPath Condition=" '$(JreRtJarPath)' != '' ">-bootclasspath "$(JreRtJarPath)" - <_JavacSourceOptions>-source $(JavacSourceVersion) -target $(JavacTargetVersion) $(_BootClassPath) + <_JavacSourceOptions>--release $(JavacTargetVersion) $(_BootClassPath) $([System.IO.Path]::GetFullPath ('$(XamarinAndroidToolsDirectory)')) diff --git a/build-tools/scripts/Prepare.targets b/build-tools/scripts/Prepare.targets index 2618d81e3..4488ec51c 100644 --- a/build-tools/scripts/Prepare.targets +++ b/build-tools/scripts/Prepare.targets @@ -15,8 +15,8 @@ <_MaxJdk>$(MaxJdkVersion) <_MaxJdk Condition=" '$(_MaxJdk)' == '' ">$(JI_MAX_JDK) - $(JAVA_HOME_11_X64) $(JAVA_HOME_17_X64) + $(JAVA_HOME_11_X64) ;"), @@ -71,6 +71,11 @@ public void ClassFileDescription () AccessFlags = MethodAccessFlags.Public, ReturnDescriptor = "I", }, + new ExpectedMethodDeclaration { + Name = "$values", + AccessFlags = MethodAccessFlags.Private | MethodAccessFlags.Static | MethodAccessFlags.Synthetic, + ReturnDescriptor = "[Lcom/xamarin/JavaEnum;", + }, new ExpectedMethodDeclaration { Name = "", AccessFlags = MethodAccessFlags.Static, diff --git a/tests/Xamarin.Android.Tools.Bytecode-Tests/JavaTypeTests.cs b/tests/Xamarin.Android.Tools.Bytecode-Tests/JavaTypeTests.cs index 6039d0598..4ec9dbe3d 100644 --- a/tests/Xamarin.Android.Tools.Bytecode-Tests/JavaTypeTests.cs +++ b/tests/Xamarin.Android.Tools.Bytecode-Tests/JavaTypeTests.cs @@ -35,6 +35,12 @@ public void ClassFile_WithJavaType_class () new TypeInfo ("com/xamarin/IJavaInterface", "Lcom/xamarin/IJavaInterface;Ljava/util/List;>;"), }, InnerClasses = { + new ExpectedInnerClassInfo { + InnerClassName = "com/xamarin/JavaType$1", + OuterClassName = null, + InnerName = null, + AccessFlags = 0, + }, new ExpectedInnerClassInfo { InnerClassName = "com/xamarin/JavaType$ASC", OuterClassName = "com/xamarin/JavaType", @@ -59,12 +65,6 @@ public void ClassFile_WithJavaType_class () InnerName = "MyStringList", AccessFlags = 0, }, - new ExpectedInnerClassInfo { - InnerClassName = "com/xamarin/JavaType$1", - OuterClassName = null, - InnerName = null, - AccessFlags = 0, - }, new ExpectedInnerClassInfo { InnerClassName = "com/xamarin/JavaType$RNC$RPNC", OuterClassName = "com/xamarin/JavaType$RNC", @@ -149,7 +149,7 @@ public void ClassFile_WithJavaType_class () Name = "STATIC_FINAL_STRING", Descriptor = "Ljava/lang/String;", AccessFlags = FieldAccessFlags.Public | FieldAccessFlags.Static | FieldAccessFlags.Final, - ConstantValue = "String(stringIndex=190 Utf8=\"Hello, \\\"embedded\0Nulls\" and \ud83d\udca9!\")", + ConstantValue = "String(stringIndex=101 Utf8=\"Hello, \\\"embedded\0Nulls\" and \ud83d\udca9!\")", }, new ExpectedFieldDeclaration { Name = "STATIC_FINAL_BOOL_FALSE", diff --git a/tests/Xamarin.Android.Tools.Bytecode-Tests/ModuleInfoTests.cs b/tests/Xamarin.Android.Tools.Bytecode-Tests/ModuleInfoTests.cs index f4019c831..035cc7083 100644 --- a/tests/Xamarin.Android.Tools.Bytecode-Tests/ModuleInfoTests.cs +++ b/tests/Xamarin.Android.Tools.Bytecode-Tests/ModuleInfoTests.cs @@ -18,7 +18,7 @@ public void ClassFile () new ExpectedTypeDeclaration { MajorVersion = 0x37, MinorVersion = 0, - ConstantPoolCount = 13, + ConstantPoolCount = 12, AccessFlags = ClassAccessFlags.Module, FullName = "module-info", }.Assert (c); diff --git a/tools/java-source-utils/src/test/java/com/microsoft/android/JavaSourceUtilsOptionsTest.java b/tools/java-source-utils/src/test/java/com/microsoft/android/JavaSourceUtilsOptionsTest.java index 771b5f85c..34f684481 100644 --- a/tools/java-source-utils/src/test/java/com/microsoft/android/JavaSourceUtilsOptionsTest.java +++ b/tools/java-source-utils/src/test/java/com/microsoft/android/JavaSourceUtilsOptionsTest.java @@ -9,8 +9,6 @@ import org.junit.Test; -import jdk.nashorn.internal.AssertsEnabled; - import static org.junit.Assert.*; public class JavaSourceUtilsOptionsTest { diff --git a/tools/java-source-utils/src/test/java/com/microsoft/android/JavadocXmlGeneratorTest.java b/tools/java-source-utils/src/test/java/com/microsoft/android/JavadocXmlGeneratorTest.java index 93eb5de4f..9215ad69a 100644 --- a/tools/java-source-utils/src/test/java/com/microsoft/android/JavadocXmlGeneratorTest.java +++ b/tools/java-source-utils/src/test/java/com/microsoft/android/JavadocXmlGeneratorTest.java @@ -99,9 +99,12 @@ private static void testWritePackages(final JniPackagesInfo packagesInfo, final generator.writePackages(packagesInfo); generator.close(); - // try (FileOutputStream o = new FileOutputStream(assertDescription + "-jonp.xml")) { - // bytes.writeTo(o); - // } + + final File actual = new File(assertDescription + "-jonp.xml"); + try (FileOutputStream o = new FileOutputStream(actual)) { + bytes.writeTo(o); + } assertEquals(assertDescription, expected, bytes.toString()); + actual.delete(); } } diff --git a/tools/java-source-utils/src/test/resources/UnresolvedTypes.xml b/tools/java-source-utils/src/test/resources/UnresolvedTypes.xml index 8c175a3cf..89762f592 100644 --- a/tools/java-source-utils/src/test/resources/UnresolvedTypes.xml +++ b/tools/java-source-utils/src/test/resources/UnresolvedTypes.xml @@ -4,11 +4,9 @@ - - - +JNI Sig: method.([L.*example.name.UnresolvedParameterType;)L.*UnresolvedReturnType;]]> diff --git a/tools/java-source-utils/src/test/resources/com/microsoft/android/DemoInfo.xml b/tools/java-source-utils/src/test/resources/com/microsoft/android/DemoInfo.xml index bd6cd818b..04670d3ea 100644 --- a/tools/java-source-utils/src/test/resources/com/microsoft/android/DemoInfo.xml +++ b/tools/java-source-utils/src/test/resources/com/microsoft/android/DemoInfo.xml @@ -2,57 +2,39 @@ - - - + - - .(ILjava/lang/String;)V]]> - + .(ILjava/lang/String;)V]]> - - - + - - - + - - - + - - - + - - - + - - - + - - - + diff --git a/tools/java-source-utils/src/test/resources/com/microsoft/android/JavaType.xml b/tools/java-source-utils/src/test/resources/com/microsoft/android/JavaType.xml index 7554cea00..873dc42be 100644 --- a/tools/java-source-utils/src/test/resources/com/microsoft/android/JavaType.xml +++ b/tools/java-source-utils/src/test/resources/com/microsoft/android/JavaType.xml @@ -2,192 +2,122 @@ - - - + - - Paragraphs of text? -@return some value]]> - +@return some value]]> - - ]]> - +@param ]]> - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + @@ -195,73 +125,49 @@ - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + - - - + diff --git a/tools/java-source-utils/src/test/resources/com/microsoft/android/Outer.xml b/tools/java-source-utils/src/test/resources/com/microsoft/android/Outer.xml index aec452fb2..e073732d1 100644 --- a/tools/java-source-utils/src/test/resources/com/microsoft/android/Outer.xml +++ b/tools/java-source-utils/src/test/resources/com/microsoft/android/Outer.xml @@ -2,103 +2,77 @@ - - - +JNI sig: Lexample/Outer;]]> - - (java.lang.Object value) + (java.lang.Object value) -JNI sig: (Ljava/lang/Object;)V]]> - +JNI sig: (Ljava/lang/Object;)V]]> - - list) + list) This is a paragraph. Yay? JNI sig: (Ljava/util/List;)Ljava/lang/Error; @param list just some random items -@return some value]]> - +@return some value]]> - - - +JNI sig: ([Ljava/lang/String;)V]]> - - - +JNI sig: (Ljava/lang/CharSequence;[S[Ljava/lang/Appendable;)Ljava/lang/Appendable;]]> - - - + - - - + - - - +@throws Throwable never, just because]]> - - - + - - - + - - map) + map) JNI sig: map(Ljava/util/Map;)V -@param map]]> - +@param map]]> - - - +JNI sig: Lexample/Outer$MyAnnotation;]]> - - - +@return some random keys]]>
This is a paragraph. Yay?