diff options
author | chibash <chiba@javassist.org> | 2016-08-02 01:36:45 +0900 |
---|---|---|
committer | chibash <chiba@javassist.org> | 2016-08-02 01:36:45 +0900 |
commit | 0ebd27d23e6cf16be080ee2ca89255429f06b5ad (patch) | |
tree | 401a17dece8b046df71370aed39f74f6d11d3ace /src/main | |
parent | 4ed22b0f7fab7c237d732e446ae43ee9af112df4 (diff) | |
download | javassist-0ebd27d23e6cf16be080ee2ca89255429f06b5ad.tar.gz javassist-0ebd27d23e6cf16be080ee2ca89255429f06b5ad.zip |
fixes calls to a deprecated method in Java 9.rel_3_21_0-java9-ea
Diffstat (limited to 'src/main')
23 files changed, 52 insertions, 45 deletions
diff --git a/src/main/META-INF/MANIFEST.MF b/src/main/META-INF/MANIFEST.MF index 28b3763b..aace2149 100644 --- a/src/main/META-INF/MANIFEST.MF +++ b/src/main/META-INF/MANIFEST.MF @@ -1,4 +1,4 @@ Specification-Title: Javassist Specification-Vendor: Shigeru Chiba, www.javassist.org -Specification-Version: 3.20.0-GA +Specification-Version: 3.21.0-GA Main-Class: javassist.CtClass diff --git a/src/main/javassist/ClassPool.java b/src/main/javassist/ClassPool.java index 11f226f1..c5d3c09a 100644 --- a/src/main/javassist/ClassPool.java +++ b/src/main/javassist/ClassPool.java @@ -1154,13 +1154,13 @@ public class ClassPool { Object[] args; if (domain == null) { method = defineClass1; - args = new Object[] { ct.getName(), b, new Integer(0), - new Integer(b.length)}; + args = new Object[] { ct.getName(), b, Integer.valueOf(0), + Integer.valueOf(b.length)}; } else { method = defineClass2; - args = new Object[] { ct.getName(), b, new Integer(0), - new Integer(b.length), domain}; + args = new Object[] { ct.getName(), b, Integer.valueOf(0), + Integer.valueOf(b.length), domain}; } return (Class)toClass2(method, loader, args); diff --git a/src/main/javassist/CtClass.java b/src/main/javassist/CtClass.java index 8aafc445..31e86044 100644 --- a/src/main/javassist/CtClass.java +++ b/src/main/javassist/CtClass.java @@ -69,7 +69,7 @@ public abstract class CtClass { /** * The version number of this release. */ - public static final String version = "3.20.0-GA"; + public static final String version = "3.21.0-GA"; /** * Prints the version number and the copyright notice. @@ -80,7 +80,7 @@ public abstract class CtClass { */ public static void main(String[] args) { System.out.println("Javassist version " + CtClass.version); - System.out.println("Copyright (C) 1999-2015 Shigeru Chiba." + System.out.println("Copyright (C) 1999-2016 Shigeru Chiba." + " All Rights Reserved."); } diff --git a/src/main/javassist/CtField.java b/src/main/javassist/CtField.java index a4cb01e1..0121e25e 100644 --- a/src/main/javassist/CtField.java +++ b/src/main/javassist/CtField.java @@ -416,18 +416,18 @@ public class CtField extends CtMember { ConstPool cp = fieldInfo.getConstPool(); switch (cp.getTag(index)) { case ConstPool.CONST_Long : - return new Long(cp.getLongInfo(index)); + return Long.valueOf(cp.getLongInfo(index)); case ConstPool.CONST_Float : - return new Float(cp.getFloatInfo(index)); + return Float.valueOf(cp.getFloatInfo(index)); case ConstPool.CONST_Double : - return new Double(cp.getDoubleInfo(index)); + return Double.valueOf(cp.getDoubleInfo(index)); case ConstPool.CONST_Integer : int value = cp.getIntegerInfo(index); // "Z" means boolean type. if ("Z".equals(fieldInfo.getDescriptor())) - return new Boolean(value != 0); + return Boolean.valueOf(value != 0); else - return new Integer(value); + return Integer.valueOf(value); case ConstPool.CONST_String : return cp.getStringInfo(index); default : diff --git a/src/main/javassist/bytecode/ConstPool.java b/src/main/javassist/bytecode/ConstPool.java index 06df1327..86d7eb40 100644 --- a/src/main/javassist/bytecode/ConstPool.java +++ b/src/main/javassist/bytecode/ConstPool.java @@ -567,13 +567,13 @@ public final class ConstPool { if (constInfo instanceof StringInfo) value = this.getStringInfo(index); else if (constInfo instanceof FloatInfo) - value = new Float(getFloatInfo(index)); + value = Float.valueOf(getFloatInfo(index)); else if (constInfo instanceof IntegerInfo) - value = new Integer(getIntegerInfo(index)); + value = Integer.valueOf(getIntegerInfo(index)); else if (constInfo instanceof LongInfo) - value = new Long(getLongInfo(index)); + value = Long.valueOf(getLongInfo(index)); else if (constInfo instanceof DoubleInfo) - value = new Double(getDoubleInfo(index)); + value = Double.valueOf(getDoubleInfo(index)); else value = null; diff --git a/src/main/javassist/bytecode/analysis/Subroutine.java b/src/main/javassist/bytecode/analysis/Subroutine.java index ca0d1737..381ed6ab 100644 --- a/src/main/javassist/bytecode/analysis/Subroutine.java +++ b/src/main/javassist/bytecode/analysis/Subroutine.java @@ -34,11 +34,11 @@ public class Subroutine { public Subroutine(int start, int caller) { this.start = start; - callers.add(new Integer(caller)); + callers.add(Integer.valueOf(caller)); } public void addCaller(int caller) { - callers.add(new Integer(caller)); + callers.add(Integer.valueOf(caller)); } public int start() { @@ -46,11 +46,11 @@ public class Subroutine { } public void access(int index) { - access.add(new Integer(index)); + access.add(Integer.valueOf(index)); } public boolean isAccessed(int index) { - return access.contains(new Integer(index)); + return access.contains(Integer.valueOf(index)); } public Collection accessed() { diff --git a/src/main/javassist/bytecode/analysis/SubroutineScanner.java b/src/main/javassist/bytecode/analysis/SubroutineScanner.java index 8cf688f5..c0af816a 100644 --- a/src/main/javassist/bytecode/analysis/SubroutineScanner.java +++ b/src/main/javassist/bytecode/analysis/SubroutineScanner.java @@ -62,10 +62,10 @@ public class SubroutineScanner implements Opcode { private void scan(int pos, CodeIterator iter, Subroutine sub) throws BadBytecode { // Skip already processed blocks - if (done.contains(new Integer(pos))) + if (done.contains(Integer.valueOf(pos))) return; - done.add(new Integer(pos)); + done.add(Integer.valueOf(pos)); int old = iter.lookAhead(); iter.move(pos); @@ -103,10 +103,10 @@ public class SubroutineScanner implements Opcode { if (Util.isJumpInstruction(opcode)) { int target = Util.getJumpTarget(pos, iter); if (opcode == JSR || opcode == JSR_W) { - Subroutine s = (Subroutine) subTable.get(new Integer(target)); + Subroutine s = (Subroutine) subTable.get(Integer.valueOf(target)); if (s == null) { s = new Subroutine(target, pos); - subTable.put(new Integer(target), s); + subTable.put(Integer.valueOf(target), s); scan(target, iter, s); } else { s.addCaller(pos); diff --git a/src/main/javassist/bytecode/annotation/AnnotationImpl.java b/src/main/javassist/bytecode/annotation/AnnotationImpl.java index dabf1f44..babac927 100644 --- a/src/main/javassist/bytecode/annotation/AnnotationImpl.java +++ b/src/main/javassist/bytecode/annotation/AnnotationImpl.java @@ -131,12 +131,12 @@ public class AnnotationImpl implements InvocationHandler { if (Object.class == method.getDeclaringClass()) { if ("equals".equals(name)) { Object obj = args[0]; - return new Boolean(checkEquals(obj)); + return Boolean.valueOf(checkEquals(obj)); } else if ("toString".equals(name)) return annotation.toString(); else if ("hashCode".equals(name)) - return new Integer(hashCode()); + return Integer.valueOf(hashCode()); } else if ("annotationType".equals(name) && method.getParameterTypes().length == 0) diff --git a/src/main/javassist/bytecode/annotation/BooleanMemberValue.java b/src/main/javassist/bytecode/annotation/BooleanMemberValue.java index 17756900..b005ad5a 100644 --- a/src/main/javassist/bytecode/annotation/BooleanMemberValue.java +++ b/src/main/javassist/bytecode/annotation/BooleanMemberValue.java @@ -59,7 +59,7 @@ public class BooleanMemberValue extends MemberValue { } Object getValue(ClassLoader cl, ClassPool cp, Method m) { - return new Boolean(getValue()); + return Boolean.valueOf(getValue()); } Class getType(ClassLoader cl) { diff --git a/src/main/javassist/bytecode/annotation/ByteMemberValue.java b/src/main/javassist/bytecode/annotation/ByteMemberValue.java index 63aad72a..d0fb5c61 100644 --- a/src/main/javassist/bytecode/annotation/ByteMemberValue.java +++ b/src/main/javassist/bytecode/annotation/ByteMemberValue.java @@ -59,7 +59,7 @@ public class ByteMemberValue extends MemberValue { } Object getValue(ClassLoader cl, ClassPool cp, Method m) { - return new Byte(getValue()); + return Byte.valueOf(getValue()); } Class getType(ClassLoader cl) { diff --git a/src/main/javassist/bytecode/annotation/CharMemberValue.java b/src/main/javassist/bytecode/annotation/CharMemberValue.java index 1b991d29..ce5d4199 100644 --- a/src/main/javassist/bytecode/annotation/CharMemberValue.java +++ b/src/main/javassist/bytecode/annotation/CharMemberValue.java @@ -60,7 +60,7 @@ public class CharMemberValue extends MemberValue { } Object getValue(ClassLoader cl, ClassPool cp, Method m) { - return new Character(getValue()); + return Character.valueOf(getValue()); } Class getType(ClassLoader cl) { diff --git a/src/main/javassist/bytecode/annotation/DoubleMemberValue.java b/src/main/javassist/bytecode/annotation/DoubleMemberValue.java index f8b417fa..0f18a72d 100644 --- a/src/main/javassist/bytecode/annotation/DoubleMemberValue.java +++ b/src/main/javassist/bytecode/annotation/DoubleMemberValue.java @@ -61,7 +61,7 @@ public class DoubleMemberValue extends MemberValue { } Object getValue(ClassLoader cl, ClassPool cp, Method m) { - return new Double(getValue()); + return Double.valueOf(getValue()); } Class getType(ClassLoader cl) { diff --git a/src/main/javassist/bytecode/annotation/FloatMemberValue.java b/src/main/javassist/bytecode/annotation/FloatMemberValue.java index 35152fdd..3bf07ef0 100644 --- a/src/main/javassist/bytecode/annotation/FloatMemberValue.java +++ b/src/main/javassist/bytecode/annotation/FloatMemberValue.java @@ -61,7 +61,7 @@ public class FloatMemberValue extends MemberValue { } Object getValue(ClassLoader cl, ClassPool cp, Method m) { - return new Float(getValue()); + return Float.valueOf(getValue()); } Class getType(ClassLoader cl) { diff --git a/src/main/javassist/bytecode/annotation/IntegerMemberValue.java b/src/main/javassist/bytecode/annotation/IntegerMemberValue.java index 6783b827..83e4e70f 100644 --- a/src/main/javassist/bytecode/annotation/IntegerMemberValue.java +++ b/src/main/javassist/bytecode/annotation/IntegerMemberValue.java @@ -66,7 +66,7 @@ public class IntegerMemberValue extends MemberValue { } Object getValue(ClassLoader cl, ClassPool cp, Method m) { - return new Integer(getValue()); + return Integer.valueOf(getValue()); } Class getType(ClassLoader cl) { diff --git a/src/main/javassist/bytecode/annotation/LongMemberValue.java b/src/main/javassist/bytecode/annotation/LongMemberValue.java index eafb5b82..7f0c6fec 100644 --- a/src/main/javassist/bytecode/annotation/LongMemberValue.java +++ b/src/main/javassist/bytecode/annotation/LongMemberValue.java @@ -60,7 +60,7 @@ public class LongMemberValue extends MemberValue { } Object getValue(ClassLoader cl, ClassPool cp, Method m) { - return new Long(getValue()); + return Long.valueOf(getValue()); } Class getType(ClassLoader cl) { diff --git a/src/main/javassist/bytecode/annotation/ShortMemberValue.java b/src/main/javassist/bytecode/annotation/ShortMemberValue.java index 909c09ee..82a6f59e 100644 --- a/src/main/javassist/bytecode/annotation/ShortMemberValue.java +++ b/src/main/javassist/bytecode/annotation/ShortMemberValue.java @@ -60,7 +60,7 @@ public class ShortMemberValue extends MemberValue { } Object getValue(ClassLoader cl, ClassPool cp, Method m) { - return new Short(getValue()); + return Short.valueOf(getValue()); } Class getType(ClassLoader cl) { diff --git a/src/main/javassist/bytecode/stackmap/BasicBlock.java b/src/main/javassist/bytecode/stackmap/BasicBlock.java index 79ec5a77..7a643609 100644 --- a/src/main/javassist/bytecode/stackmap/BasicBlock.java +++ b/src/main/javassist/bytecode/stackmap/BasicBlock.java @@ -196,7 +196,7 @@ public class BasicBlock { private Mark makeMark0(HashMap table, int pos, boolean isBlockBegin, boolean isTarget) { - Integer p = new Integer(pos); + Integer p = Integer.valueOf(pos); Mark m = (Mark)table.get(p); if (m == null) { m = new Mark(pos); diff --git a/src/main/javassist/compiler/CodeGen.java b/src/main/javassist/compiler/CodeGen.java index e02884de..ab02d8cf 100644 --- a/src/main/javassist/compiler/CodeGen.java +++ b/src/main/javassist/compiler/CodeGen.java @@ -595,7 +595,7 @@ public abstract class CodeGen extends Visitor implements Opcode, TokenId { "sorry, not support labeled break or continue"); bytecode.addOpcode(Opcode.GOTO); - Integer pc = new Integer(bytecode.currentPc()); + Integer pc = Integer.valueOf(bytecode.currentPc()); bytecode.addIndex(0); if (notCont) breakList.add(pc); diff --git a/src/main/javassist/compiler/KeywordTable.java b/src/main/javassist/compiler/KeywordTable.java index 3f0025fe..5f516e3d 100644 --- a/src/main/javassist/compiler/KeywordTable.java +++ b/src/main/javassist/compiler/KeywordTable.java @@ -28,6 +28,6 @@ public final class KeywordTable extends java.util.HashMap { } public void append(String name, int t) { - put(name, new Integer(t)); + put(name, Integer.valueOf(t)); } } diff --git a/src/main/javassist/compiler/MemberCodeGen.java b/src/main/javassist/compiler/MemberCodeGen.java index b1f932ca..07c113a3 100644 --- a/src/main/javassist/compiler/MemberCodeGen.java +++ b/src/main/javassist/compiler/MemberCodeGen.java @@ -209,7 +209,7 @@ public class MemberCodeGen extends CodeGen { boolean tryNotReturn = !hasReturned; if (tryNotReturn) { bc.addOpcode(Opcode.GOTO); - gotoList.add(new Integer(bc.currentPc())); + gotoList.add(Integer.valueOf(bc.currentPc())); bc.addIndex(0); // correct later } @@ -235,7 +235,7 @@ public class MemberCodeGen extends CodeGen { if (!hasReturned) { bc.addOpcode(Opcode.GOTO); - gotoList.add(new Integer(bc.currentPc())); + gotoList.add(Integer.valueOf(bc.currentPc())); bc.addIndex(0); // correct later tryNotReturn = true; } diff --git a/src/main/javassist/tools/rmi/ObjectImporter.java b/src/main/javassist/tools/rmi/ObjectImporter.java index 476ec3c8..43b62039 100644 --- a/src/main/javassist/tools/rmi/ObjectImporter.java +++ b/src/main/javassist/tools/rmi/ObjectImporter.java @@ -189,7 +189,7 @@ public class ObjectImporter implements java.io.Serializable { private Object createProxy(int oid, String classname) throws Exception { Class c = Class.forName(classname); Constructor cons = c.getConstructor(proxyConstructorParamTypes); - return cons.newInstance(new Object[] { this, new Integer(oid) }); + return cons.newInstance(new Object[] { this, Integer.valueOf(oid) }); } /** diff --git a/src/main/javassist/util/proxy/FactoryHelper.java b/src/main/javassist/util/proxy/FactoryHelper.java index 9b2b791c..b17b78ed 100644 --- a/src/main/javassist/util/proxy/FactoryHelper.java +++ b/src/main/javassist/util/proxy/FactoryHelper.java @@ -152,13 +152,13 @@ public class FactoryHelper { Object[] args; if (domain == null) { method = defineClass1; - args = new Object[] { cf.getName(), b, new Integer(0), - new Integer(b.length) }; + args = new Object[] { cf.getName(), b, Integer.valueOf(0), + Integer.valueOf(b.length) }; } else { method = defineClass2; - args = new Object[] { cf.getName(), b, new Integer(0), - new Integer(b.length), domain }; + args = new Object[] { cf.getName(), b, Integer.valueOf(0), + Integer.valueOf(b.length), domain }; } return toClass2(method, loader, args); diff --git a/src/main/javassist/util/proxy/SerializedProxy.java b/src/main/javassist/util/proxy/SerializedProxy.java index 36425a88..a0485da0 100644 --- a/src/main/javassist/util/proxy/SerializedProxy.java +++ b/src/main/javassist/util/proxy/SerializedProxy.java @@ -17,6 +17,7 @@ package javassist.util.proxy; import java.io.Serializable; +import java.lang.reflect.InvocationTargetException; import java.io.ObjectStreamException; import java.security.AccessController; import java.security.PrivilegedActionException; @@ -82,10 +83,16 @@ class SerializedProxy implements Serializable { ProxyFactory f = new ProxyFactory(); f.setSuperclass(loadClass(superClass)); f.setInterfaces(infs); - Proxy proxy = (Proxy)f.createClass(filterSignature).newInstance(); + Proxy proxy = (Proxy)f.createClass(filterSignature).getConstructor().newInstance(); proxy.setHandler(handler); return proxy; } + catch (NoSuchMethodException e) { + throw new java.io.InvalidClassException(e.getMessage()); + } + catch (InvocationTargetException e) { + throw new java.io.InvalidClassException(e.getMessage()); + } catch (ClassNotFoundException e) { throw new java.io.InvalidClassException(e.getMessage()); } |