Skip to content

Commit

Permalink
Update to ASM 9.3 to support Java 19 bytecode; use fork=true for all …
Browse files Browse the repository at this point in the history
…java tasks (security manager). This closes #204 (#205)
  • Loading branch information
uschindler authored Sep 23, 2022
1 parent 89dd053 commit 500e8cc
Show file tree
Hide file tree
Showing 7 changed files with 684 additions and 8 deletions.
6 changes: 4 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<equals arg1="${-cleaned.specification.version}" arg2="16"/>
<equals arg1="${-cleaned.specification.version}" arg2="17"/>
<equals arg1="${-cleaned.specification.version}" arg2="18"/>
<equals arg1="${-cleaned.specification.version}" arg2="19"/>
</or>
</condition>

Expand Down Expand Up @@ -163,6 +164,7 @@
<equals arg1="${build.java.runtime}" arg2="16"/>
<equals arg1="${build.java.runtime}" arg2="17"/>
<equals arg1="${build.java.runtime}" arg2="18"/>
<equals arg1="${build.java.runtime}" arg2="19"/>
</or>
</condition>

Expand Down Expand Up @@ -354,7 +356,7 @@
<target name="-get-cli-help" depends="compile" unless="cli-help">
<local name="-cli-help"/>
<java classname="${cli-classname}" classpathref="path.main-run"
failonerror="true" fork="false" outputproperty="-cli-help">
failonerror="true" fork="true" outputproperty="-cli-help">
<arg value="--help"/>
</java>
<!-- fix the line endings & command line (cannot be done in java task directly! -->
Expand Down Expand Up @@ -690,7 +692,7 @@
<target name="generate-internal" depends="compile-tools" description="Generates internal API signature lists for current JDK">
<mkdir dir="${signatures.dir}"/>
<property name="internal.output.file" location="${signatures.dir}/jdk-internal-${build.java.runtime}.txt"/>
<java classpathref="path.tools-run" classname="de.thetaphi.forbiddenapis.InternalApiGen" fork="false">
<java classpathref="path.tools-run" classname="de.thetaphi.forbiddenapis.InternalApiGen" fork="true">
<arg value="${build.java.runtime}"/>
<arg file="${internal.output.file}"/>
</java>
Expand Down
4 changes: 2 additions & 2 deletions ivy.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<!DOCTYPE ivy-module [
<!ENTITY maven.version "2.0">
<!ENTITY gradle.version "3.4">
<!ENTITY asm.version "9.2">
<!ENTITY asm.version "9.3">
<!ENTITY jarjar.asm.version "5.2">
]>
<ivy-module version="2.0">
Expand Down Expand Up @@ -52,7 +52,7 @@
-->
<dependency org="org.codehaus.plexus" name="plexus-utils" rev="1.1" conf="build,bundle"/>
<dependency org="commons-cli" name="commons-cli" rev="1.3.1" conf="build,bundle"/>
<dependency org="org.apache.ant" name="ant-antunit" rev="1.3" conf="test"/>
<dependency org="org.apache.ant" name="ant-antunit" rev="1.4.1" conf="test"/>
<dependency org="ant-contrib" name="ant-contrib" rev="1.0b3" conf="test"/>
<dependency org="junit" name="junit" rev="4.12" conf="test"/>
<dependency org="org.hamcrest" name="hamcrest-core" rev="1.3" conf="test"/>
Expand Down
6 changes: 3 additions & 3 deletions src/main/docs/bundled-signatures.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ <h1>Bundled Signatures Documentation</h1>
<li><strong><tt>jdk-unsafe-*</tt>:</strong> Signatures
of &quot;unsafe&quot; methods that use default charset, default locale, or default timezone. For server applications it is very
stupid to call those methods, as the results will definitely not what the user wants
(for Java <tt>*</tt> = 1.7, 1.8, 9,..., 18; Ant / Maven / Gradle automatically add the compile Java version).</li>
(for Java <tt>*</tt> = 1.7, 1.8, 9,..., 19; Ant / Maven / Gradle automatically add the compile Java version).</li>

<li><strong><tt>jdk-deprecated-*</tt>:</strong> This disallows all deprecated
methods from the JDK (for Java <tt>*</tt> = 1.7, 1.8, 9,..., 18; Ant / Maven / Gradle automatically add the compile Java version).</li>
methods from the JDK (for Java <tt>*</tt> = 1.7, 1.8, 9,..., 19; Ant / Maven / Gradle automatically add the compile Java version).</li>

<li><strong><tt>jdk-internal-*</tt>:</strong> Lists all internal packages of the JDK as of <code>Security.getProperty(&quot;package.access&quot;)</code>.
Calling those methods will always trigger security manager and is completely forbidden from Java 9 on
(for Java <tt>*</tt> = 1.7, 1.8, 9,..., 18; Ant / Maven / Gradle automatically add the compile Java version, <em>since forbiddenapis v2.1</em>).</li>
(for Java <tt>*</tt> = 1.7, 1.8, 9,..., 19; Ant / Maven / Gradle automatically add the compile Java version, <em>since forbiddenapis v2.1</em>).</li>

<li><strong><tt>jdk-non-portable</tt>:</strong> Signatures of all non-portable (like <code>com.sun.management.HotSpotDiagnosticMXBean</code>)
or internal runtime APIs (like <code>sun.misc.Unsafe</code>). This is a superset of <tt>jdk-internal</tt>.<br>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/de/thetaphi/forbiddenapis/AsmUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ private static byte[] readStream(final InputStream in) throws IOException {
@SuppressWarnings("unused")
public static ClassReader readAndPatchClass(InputStream in) throws IOException {
final byte[] bytecode = readStream(in);
if (false) patchClassMajorVersion(bytecode, Opcodes.V17 + 1, Opcodes.V17);
if (false) patchClassMajorVersion(bytecode, Opcodes.V19 + 1, Opcodes.V19);
return new ClassReader(bytecode);
}

Expand Down
Loading

0 comments on commit 500e8cc

Please sign in to comment.