Skip to content

Commit

Permalink
Additional fixes to get things compiling under JDK9.
Browse files Browse the repository at this point in the history
* Remove ISO_8859_1 class that references inaccessible sun package
* Reflectively attempt to start JMX agent (not accessible in 9)
* Remove use of problematic Generated annotation (not accessible)
headius committed Apr 11, 2017
1 parent c64e360 commit 4a27150
Showing 5 changed files with 4 additions and 207 deletions.
2 changes: 0 additions & 2 deletions core/src/main/java/org/jruby/anno/AnnotationBinder.java
Original file line number Diff line number Diff line change
@@ -126,9 +126,7 @@ public void processType(TypeElement cd) {
out.println("import org.jruby.runtime.MethodIndex;");
out.println("import java.util.Arrays;");
out.println("import java.util.List;");
out.println("import javax.annotation.Generated;");

out.println("@Generated(\"org.jruby.anno.AnnotationBinder\")");
out.println("public class " + qualifiedName + POPULATOR_SUFFIX + " extends TypePopulator {");
out.println(" public void populate(RubyModule cls, Class clazz) {");
if (DEBUG) {
3 changes: 0 additions & 3 deletions core/src/main/java/org/jruby/anno/IndyBinder.java
Original file line number Diff line number Diff line change
@@ -37,7 +37,6 @@
import org.objectweb.asm.Type;
import org.objectweb.asm.commons.Method;

import javax.annotation.Generated;
import javax.annotation.processing.AbstractProcessor;
import javax.annotation.processing.RoundEnvironment;
import javax.annotation.processing.SupportedAnnotationTypes;
@@ -128,8 +127,6 @@ public void processType(TypeElement cd) {

ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_FRAMES | ClassWriter.COMPUTE_MAXS);

cw.visitAnnotation(p(Generated.class), true);

cw.visit(Opcodes.V1_7, ACC_PUBLIC, ("org.jruby.gen." + qualifiedName + POPULATOR_SUFFIX).replace('.', '/'), null, "org/jruby/anno/TypePopulator", null);

mv = new SkinnyMethodAdapter(cw, ACC_PUBLIC, "<init>", "()V", null, null);
5 changes: 4 additions & 1 deletion core/src/main/java/org/jruby/management/BeanManagerImpl.java
Original file line number Diff line number Diff line change
@@ -84,7 +84,10 @@ public boolean tryShutdownAgent() {

public boolean tryRestartAgent() {
try {
sun.management.Agent.startAgent();
Class agent = Class.forName("sun.management.Agent");
Method shutdown = agent.getDeclaredMethod("startAgent");
shutdown.setAccessible(true);
shutdown.invoke(null);
return true;
} catch (Exception e) {
return false;
Original file line number Diff line number Diff line change
@@ -24,7 +24,6 @@
import org.jruby.RubyString;
import org.jruby.ext.nkf.RubyNKF;
import org.jruby.util.SafePropertyAccessor;
import org.jruby.util.encoding.ISO_8859_16;
import org.jruby.util.io.EncodingUtils;

public final class EncodingService {
@@ -400,10 +399,6 @@ public Charset charsetForEncoding(Encoding encoding) {
return Charset.forName("ISO-8859-1");
}

if (encoding == ISO8859_16Encoding.INSTANCE) {
return ISO_8859_16.INSTANCE;
}

try {
return Charset.forName(encoding.toString());
} catch (UnsupportedCharsetException uce) {
196 changes: 0 additions & 196 deletions core/src/main/java/org/jruby/util/encoding/ISO_8859_16.java

This file was deleted.

0 comments on commit 4a27150

Please sign in to comment.