Merge pull request #317 from liblit/future-java-compatibility-fixes

Future Java compatibility fixes
This commit is contained in:
Julian Dolby 2018-06-06 12:52:51 -04:00 committed by GitHub
commit b1b09684bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
46 changed files with 244 additions and 226 deletions

View File

@ -8,7 +8,7 @@ plugins {
id 'com.github.hauner.jarTest' version '1.0.1' apply false
id 'de.undercouch.download'
id 'nebula.lint' version '8.3.1'
id "nebula.source-jar" version '7.0.1' apply false
id 'nebula.source-jar' version '7.0.1' apply false
}
@ -66,8 +66,6 @@ subprojects { subproject ->
apply plugin: 'maven-publish'
apply plugin: 'nebula.source-jar'
sourceCompatibility = 1.8
version rootProject.version
repositories {

View File

@ -188,7 +188,7 @@ public class JDT2CAstUtils {
*/
public static Object defaultValueForType(ITypeBinding type) {
if (isLongOrLess(type))
return new Integer(0);
return Integer.valueOf(0);
else if (type.getBinaryName().equals("D") || type.getBinaryName().equals("F"))
return new Double(0.0);
else

View File

@ -2329,7 +2329,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
private CAstNode getSwitchCaseConstant(SwitchCase n, WalkContext context) {
// TODO: enums
Expression expr = n.getExpression();
Object constant = (expr == null) ? new Integer(0) : expr.resolveConstantExpressionValue(); // default case label of
Object constant = (expr == null) ? Integer.valueOf(0) : expr.resolveConstantExpressionValue(); // default case label of
// "0" (what polyglot
// does). we also set
// SWITCH_DEFAULT
@ -2586,7 +2586,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
/*------ indexDecl --------- int tmpindex = 0 ------*/
final String tmpIndexName = "for temp index";
CAstNode indexDeclNode = makeNode(context, fFactory, n, CAstNode.DECL_STMT, fFactory.makeConstant(new InternalCAstSymbol(
tmpIndexName, fTypeDict.getCAstTypeFor(ast.resolveWellKnownType("int")), true)), fFactory.makeConstant(new Integer(0)));
tmpIndexName, fTypeDict.getCAstTypeFor(ast.resolveWellKnownType("int")), true)), fFactory.makeConstant(Integer.valueOf(0)));
/*------ cond ------------- tmpindex < tmparray.length ------*/
CAstNode tmpArrayLengthNode = makeNode(context, fFactory, n, CAstNode.ARRAY_LENGTH, makeNode(context, fFactory, n,

View File

@ -15,7 +15,7 @@ public class AnonymousClass {
}
public static void main(String[] args) {
final Integer base = new Integer(6);
final Integer base = Integer.valueOf(6);
Foo f= new Foo() {
int value = 3;
@ -34,7 +34,7 @@ public class AnonymousClass {
}
public void method() {
final Integer base = new Integer(7);
final Integer base = Integer.valueOf(7);
abstract class FooImpl implements Foo {
int y;

View File

@ -12,6 +12,6 @@ public class ArrayLiteral1 {
public static void main(String[] args) {
ArrayLiteral1 al1= new ArrayLiteral1();
int[] a= new int[] { 0, 1, 2, 3, 5 };
Object[] b= new Object[] { null, "hi", new Integer(55), new int[] { 3, 1, 4 } };
Object[] b= new Object[] { null, "hi", Integer.valueOf(55), new int[] { 3, 1, 4 } };
}
}

View File

@ -10,7 +10,7 @@
*****************************************************************************/
public class LocalClass {
public static void main(String[] args) {
final Integer base = new Integer(6);
final Integer base = Integer.valueOf(6);
class Foo {
int value;
@ -27,7 +27,7 @@ public class LocalClass {
}
public void method() {
final Integer base = new Integer(6);
final Integer base = Integer.valueOf(6);
class Foo {
int value;

View File

@ -64,7 +64,7 @@ public class BasicsGenerics {
System.out.println(frenchy);
System.out.println(sicilian);
strs.add("hello");
ints.add(new Integer(3));
ints.add(Integer.valueOf(3));
String qqq;

View File

@ -47,8 +47,8 @@ public class ExplicitBoxingTest {
int a = 6;
a = a + a;
System.out.println(a);
Integer useless1 = new Integer(5+6);
Integer aa = new Integer(a+a);
Integer useless1 = Integer.valueOf(5+6);
Integer aa = Integer.valueOf(a+a);
int aaa = aa.intValue();
System.out.println(aaa);

View File

@ -50,7 +50,7 @@ public class GenericArrays {
Object o = lsa;
Object[] oa = (Object[]) o;
List<Integer> li = new ArrayList<>();
li.add(new Integer(3));
li.add(Integer.valueOf(3));
oa[1] = li; // correct
String s = (String) lsa[1].get(0); // run time error, but cast is explicit

View File

@ -58,7 +58,7 @@ public class MoreOverriddenGenerics {
@Override
public Long get() {
return new Long(6);
return Long.valueOf(6);
}
}

View File

@ -46,7 +46,7 @@ public class OverridesOnePointFour {
@Override
public Long get() {
return new Long(6);
return Long.valueOf(6);
}
}

View File

@ -72,8 +72,8 @@ public class Wildcards {
printCollection2(e);
ArrayList<Integer> e3 = new ArrayList<>();
e3.add(new Integer(123));
e3.add(new Integer(42));
e3.add(Integer.valueOf(123));
e3.add(Integer.valueOf(42));
printCollection(e3);
printCollection1(e3);

View File

@ -25,6 +25,9 @@ dependencies {
test {
environment 'TRAVIS', 1
maxHeapSize = '800M'
if (gradle.startParameter.offline)
exclude '**/FieldBasedJQueryTest.class'
}
task cleanTest(type: Delete) {

View File

@ -69,7 +69,7 @@ public class WebPageLoaderFactory extends JavaScriptLoaderFactory {
translateConditionOpcode(CAstOperator.OP_NE),
null,
isDefined,
context.currentScope().getConstantValue(new Integer(0)),
context.currentScope().getConstantValue(Integer.valueOf(0)),
-1));
PreBasicBlock srcB = context.cfg().getCurrentBlock();

View File

@ -102,7 +102,7 @@ public class JavaScriptConstructorFunctions {
//S.addStatement(insts.PutInstruction(5, 4, "__proto__"));
S.getNextProgramCounter();
S.addConstant(new Integer(8), new ConstantValue(value));
S.addConstant(Integer.valueOf(8), new ConstantValue(value));
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), 5, 8, "$value"));
if (value instanceof String) {
S.addConstant(9, new ConstantValue(0));
@ -146,7 +146,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeValueConstructor(IClass cls, int nargs, Object value) {
if (nargs == 0 || nargs == 1) {
Object key = Pair.make(cls, new Integer(nargs));
Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key))
return constructors.get(key);
@ -197,7 +197,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeObjectConstructor(IClass cls, int nargs) {
if (nargs == 0 || nargs == 1) {
Object key = Pair.make(cls, new Integer(nargs));
Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key))
return constructors.get(key);
@ -213,7 +213,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeObjectCall(IClass cls, int nargs) {
assert nargs == 0;
Object key = Pair.make(cls, new Integer(nargs));
Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key))
return constructors.get(key);
@ -251,7 +251,7 @@ public class JavaScriptConstructorFunctions {
MethodReference ref = JavaScriptMethods.makeCtorReference(JavaScriptTypes.Array);
JavaScriptSummary S = new JavaScriptSummary(ref, nargs + 1);
S.addConstant(new Integer(nargs + 3), new ConstantValue("prototype"));
S.addConstant(Integer.valueOf(nargs + 3), new ConstantValue("prototype"));
S.addStatement(insts.PropertyRead(S.getNumberOfStatements(), nargs + 4, 1, nargs + 3));
S.getNextProgramCounter();
@ -263,13 +263,13 @@ public class JavaScriptConstructorFunctions {
//S.addStatement(insts.PutInstruction(nargs + 5, nargs + 4, "__proto__"));
S.getNextProgramCounter();
S.addConstant(new Integer(nargs + 7), new ConstantValue(nargs));
S.addConstant(Integer.valueOf(nargs + 7), new ConstantValue(nargs));
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), nargs + 5, nargs + 7, "length"));
S.getNextProgramCounter();
int vn = nargs + 9;
for (int i = 0; i < nargs; i++, vn += 2) {
S.addConstant(new Integer(vn), new ConstantValue(i));
S.addConstant(Integer.valueOf(vn), new ConstantValue(i));
S.addStatement(insts.PropertyWrite(S.getNumberOfStatements(), nargs + 5, vn, i + 1));
S.getNextProgramCounter();
}
@ -283,7 +283,7 @@ public class JavaScriptConstructorFunctions {
}
private IMethod makeArrayConstructor(IClass cls, int nargs) {
Object key = Pair.make(cls, new Integer(nargs));
Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key))
return constructors.get(key);
@ -296,9 +296,9 @@ public class JavaScriptConstructorFunctions {
MethodReference ref = AstMethodReference.fnReference(JavaScriptTypes.String);
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
S.addConstant(new Integer(2), new ConstantValue(""));
S.addConstant(Integer.valueOf(2), new ConstantValue(""));
S.addConstant(new Integer(3), new ConstantValue(0));
S.addConstant(Integer.valueOf(3), new ConstantValue(0));
S.addStatement(insts.PutInstruction(S.getNumberOfStatements(), 2, 3, "length"));
S.getNextProgramCounter();
@ -328,7 +328,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeStringCall(IClass cls, int nargs) {
assert nargs == 0 || nargs == 1;
Object key = Pair.make(cls, new Integer(nargs));
Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key))
return constructors.get(key);
@ -341,7 +341,7 @@ public class JavaScriptConstructorFunctions {
MethodReference ref = AstMethodReference.fnReference(JavaScriptTypes.Number);
JavaScriptSummary S = new JavaScriptSummary(ref, 1);
S.addConstant(new Integer(2), new ConstantValue(0.0));
S.addConstant(Integer.valueOf(2), new ConstantValue(0.0));
S.addStatement(insts.ReturnInstruction(S.getNumberOfStatements(), 2, false));
S.getNextProgramCounter();
@ -368,7 +368,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeNumberCall(IClass cls, int nargs) {
assert nargs == 0 || nargs == 1;
Object key = Pair.make(cls, new Integer(nargs));
Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key))
return constructors.get(key);
@ -552,7 +552,7 @@ public class JavaScriptConstructorFunctions {
private IMethod makeFunctionObjectConstructor(IClass cls, int nargs) {
JSInstructionFactory insts = (JSInstructionFactory)cls.getClassLoader().getInstructionFactory();
Object key = Pair.make(cls, new Integer(nargs));
Object key = Pair.make(cls, Integer.valueOf(nargs));
if (constructors.containsKey(key))
return constructors.get(key);
@ -601,7 +601,7 @@ public class JavaScriptConstructorFunctions {
assert nargs == 1;
return makeValueConstructor(receiver, nargs, null);
} else if (receiver.getReference().equals(JavaScriptTypes.NumberObject))
return makeValueConstructor(receiver, nargs, new Integer(0));
return makeValueConstructor(receiver, nargs, Integer.valueOf(0));
else if (receiver.getReference().equals(JavaScriptTypes.Function))
return makeFunctionConstructor(callerIR, callStmt, receiver, nargs);
else if (cha.isSubclassOf(receiver, cha.lookupClass(JavaScriptTypes.CodeBody)))

View File

@ -322,35 +322,35 @@ public class JSAstTranslator extends AstTranslator {
if (name.equals("GlobalNaN")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Float(Float.NaN))));
resultVal, context.currentScope().getConstantValue(Float.valueOf(Float.NaN))));
} else if (name.equals("GlobalInfinity")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Float(Float.POSITIVE_INFINITY))));
resultVal, context.currentScope().getConstantValue(Float.valueOf(Float.POSITIVE_INFINITY))));
} else if (name.equals("MathE")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Double(Math.E))));
resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.E))));
} else if (name.equals("MathPI")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Double(Math.PI))));
resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.PI))));
} else if (name.equals("MathSQRT1_2")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Double(Math.sqrt(.5)))));
resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.sqrt(.5)))));
} else if (name.equals("MathSQRT2")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Double(Math.sqrt(2)))));
resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.sqrt(2)))));
} else if (name.equals("MathLN2")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Double(Math.log(2)))));
resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.log(2)))));
} else if (name.equals("MathLN10")) {
context.cfg().addInstruction(
((JSInstructionFactory)insts).AssignInstruction(context.cfg().getCurrentInstruction(),
resultVal, context.currentScope().getConstantValue(new Double(Math.log(10)))));
resultVal, context.currentScope().getConstantValue(Double.valueOf(Math.log(10)))));
} else if (name.equals("NewObject")) {
doNewObject(context, null, resultVal, "Object", null);

View File

@ -26,7 +26,7 @@ public class JSConstantFoldingRewriter extends ConstantFoldingRewriter {
if (lhs instanceof String || rhs instanceof String) {
return "" + lhs + rhs;
} else if (lhs instanceof Number && rhs instanceof Number) {
return new Double(((Number)lhs).doubleValue() + ((Number)rhs).doubleValue());
return Double.valueOf(((Number)lhs).doubleValue() + ((Number)rhs).doubleValue());
}
} else if (op == CAstOperator.OP_BIT_AND) {
@ -43,7 +43,7 @@ public class JSConstantFoldingRewriter extends ConstantFoldingRewriter {
} else if (op == CAstOperator.OP_DIV) {
if (lhs instanceof Number && rhs instanceof Number) {
return new Double(((Number)lhs).doubleValue() / ((Number)rhs).doubleValue());
return Double.valueOf(((Number)lhs).doubleValue() / ((Number)rhs).doubleValue());
}
} else if (op == CAstOperator.OP_EQ) {
@ -72,12 +72,12 @@ public class JSConstantFoldingRewriter extends ConstantFoldingRewriter {
} else if (op == CAstOperator.OP_MOD) {
if (lhs instanceof Number && rhs instanceof Number) {
return new Double(((Number)lhs).doubleValue() % ((Number)rhs).doubleValue());
return Double.valueOf(((Number)lhs).doubleValue() % ((Number)rhs).doubleValue());
}
} else if (op == CAstOperator.OP_MUL) {
if (lhs instanceof Number && rhs instanceof Number) {
return new Double(((Number)lhs).doubleValue() * ((Number)rhs).doubleValue());
return Double.valueOf(((Number)lhs).doubleValue() * ((Number)rhs).doubleValue());
}
} else if (op == CAstOperator.OP_NE) {
@ -98,7 +98,7 @@ public class JSConstantFoldingRewriter extends ConstantFoldingRewriter {
} else if (op == CAstOperator.OP_SUB) {
if (lhs instanceof Number && rhs instanceof Number) {
return new Double(((Number)lhs).doubleValue() - ((Number)rhs).doubleValue());
return Double.valueOf(((Number)lhs).doubleValue() - ((Number)rhs).doubleValue());
}
} else if (op == CAstOperator.OP_URSH) {

View File

@ -2,6 +2,7 @@ plugins {
id 'com.github.hauner.jarTest'
id 'cpp'
id 'eclipse'
id 'edu.wpi.first.GradleJni' version '0.2.1'
}
eclipse.project.natures 'org.eclipse.pde.PluginNature'
@ -18,62 +19,54 @@ dependencies {
)
}
// TODO: build following targets for "test"-only, not "main"
def currentJvm = org.gradle.internal.jvm.Jvm.current()
task generateJniHeaders(type: Exec, dependsOn: [testClasses, ':com.ibm.wala.cast:classes']) {
// classes for which we need headers
def nativePackage = 'com.ibm.wala.cast.test'
def nativeClasses = ['TestNativeTranslator']
def qualifiedClasses = nativeClasses.collect { "$nativePackage.$it" }
// inputs and outputs, suitable for use with rule-based model configuration
ext {
sourceDir = null
headerDir = "$buildDir/include"
def addCastRpath(currentJvm, targetPlatform, linker) {
switch (targetPlatform.operatingSystem.name) {
case 'linux':
case 'osx':
[
// TODO: compute path on following line from 'cast' library properties somehow
"${project(':com.ibm.wala.cast').buildDir}/libs/cast/shared",
// TODO: compute paths on following lines from 'jdk' library properties somehow
"${currentJvm.javaHome}/jre/lib/amd64/server",
"${currentJvm.javaHome}/jre/lib/server",
].each { linker.args "-Wl,-rpath,$it" }
}
inputs.files files(qualifiedClasses.collect { "$buildDir/${it.replace('.', '/')}.class" })
outputs.dir headerDir
outputs.cacheIf { true }
}
// javah command to generate headers
def sourceSets = [sourceSets.test, project(':com.ibm.wala.cast').sourceSets.main]
def classesDirs = sourceSets.inject(files()) { acc, val -> acc.plus(val.output.classesDirs) }
def classpath = classesDirs.asPath
def javah = currentJvm.getExecutable('javah')
commandLine(javah, '-d', "$headerDir", '-classpath', classpath)
args(qualifiedClasses)
def addCastEnvironment(task, xlatorLibrary) {
def castLibrary = xlatorLibrary.libs[2].linkFiles.singleFile
def castLibraryDirectory = castLibrary.parent
assert castLibraryDirectory.endsWith('/com.ibm.wala.cast/build/libs/cast/shared')
task.environment 'DYLD_LIBRARY_PATH', castLibrary.parent
}
model {
components {
xlator_test(NativeLibrarySpec) {
xlator_test(JniNativeLibrarySpec) {
javaCompileTasks << compileTestJava
sources.cpp {
source {
srcDirs = ['harness-src/c']
include 'smoke.cpp'
}
generatedBy generateJniHeaders
['cast', 'jdk'].each {
lib project: ':com.ibm.wala.cast', library: it
}
}
binaries {
withType(StaticLibraryBinarySpec) {
buildable = false
}
withType(SharedLibraryBinarySpec) {
switch ("$targetPlatform.operatingSystem.name/$targetPlatform.architecture.name") {
case 'linux/x86-64':
// TODO: compute path on following line from 'cast' library properties somehow
linker.args '-Wl,-rpath', "${project(':com.ibm.wala.cast').buildDir}/libs/cast/shared"
// TODO: compute path on following line from 'jdk' library properties somehow
linker.args '-Wl,-rpath', "${currentJvm.javaHome}/jre/lib/amd64/server"
}
addCastRpath(currentJvm, targetPlatform, linker)
}
}
}
smoke_main(NativeExecutableSpec) {
sources.cpp {
source {
@ -84,25 +77,52 @@ model {
lib project: ':com.ibm.wala.cast', library: it
}
}
binaries.all {
switch ("$targetPlatform.operatingSystem.name/$targetPlatform.architecture.name") {
case 'linux/x86-64':
// TODO: compute path on following line from 'cast' library properties somehow
linker.args '-Wl,-rpath', "${project(':com.ibm.wala.cast').buildDir}/libs/cast/shared"
// TODO: compute path on following line from 'jdk' library properties somehow
linker.args '-Wl,-rpath', "${currentJvm.javaHome}/jre/lib/amd64/server"
}
addCastRpath(currentJvm, targetPlatform, linker)
}
}
}
tasks.test {
def lib = linkXlator_testSharedLibrary
dependsOn lib
systemProperty 'java.library.path', lib.destinationDirectory.orNull.asFile
tasks {
test {
def lib = linkXlator_testSharedLibrary
dependsOn lib
systemProperty 'java.library.path', lib.destinationDirectory.get().asFile
// TODO: compute path on following line from 'cast' library properties somehow
def castLibDir = "${project(':com.ibm.wala.cast').buildDir}/libs/cast/shared"
environment 'DYLD_LIBRARY_PATH', castLibDir
addCastEnvironment(it, $.binaries.xlator_testSharedLibrary)
}
checkSmoke_main(Exec) {
// main executable to run for test
def executableBinary = $.binaries.smoke_mainExecutable
executable executableBinary.executableFile
dependsOn executableBinary
def pathElements = [$.binaries.test.getClassesDir()]
// implementations of native methods
def library = $.binaries.xlator_testSharedLibrary
dependsOn library
pathElements << library.sharedLibraryFile.parent
// "primorial.txt" resource loaded during test
def coreResources = project(':com.ibm.wala.core').processResources
dependsOn coreResources
pathElements << coreResources.destinationDir
// additional supporting Java class files
['cast', 'core', 'util'].each {
def compileJava = project(":com.ibm.wala.$it").compileJava
dependsOn compileJava
pathElements << compileJava.destinationDir
}
// all combined as a colon-delimited path list
args pathElements.join(':')
addCastEnvironment(it, $.binaries.xlator_testSharedLibrary)
}
check.dependsOn checkSmoke_main
}
}

View File

@ -195,7 +195,7 @@ public abstract class TestCAstTranslator extends WalaTestCase {
for (Object name2 : cls.getDeclaredMethods()) {
IMethod mth = (IMethod) name2;
Integer np = new Integer(mth.getNumberOfParameters());
Integer np = Integer.valueOf(mth.getNumberOfParameters());
Pair<String, String> key = Pair.make(cls.getName().toString(), mth.getName().toString());
if (mth.isStatic()) {

View File

@ -42,11 +42,9 @@ model {
switch (targetPlatform.operatingSystem.name) {
case 'linux':
headers.srcDirs "$jniIncludeDir/linux"
switch (targetPlatform.architecture.name) {
case 'x86-64':
sharedLibraryLinkFile = file("$currentJavaHome/jre/lib/amd64/server/libjvm.so")
break
}
def subdirs = ['jre/lib/amd64/server', 'lib/amd64/server', 'lib/server']
def candidates = subdirs.collect { file("$currentJavaHome/$it/libjvm.so") }
sharedLibraryLinkFile = candidates.find { it.exists() }
break
case 'osx':
headers.srcDirs "$jniIncludeDir/darwin"
@ -61,6 +59,7 @@ model {
}
}
}
components {
cast(NativeLibrarySpec) {
sources.cpp {
@ -72,22 +71,17 @@ model {
exportedHeaders.srcDirs = ["$cSourceDir/include"]
lib library: 'jdk'
}
binaries {
withType(StaticLibraryBinarySpec) {
buildable = false
}
withType(SharedLibraryBinarySpec) {
switch ("$targetPlatform.operatingSystem.name/$targetPlatform.architecture.name") {
case 'linux/x86-64':
$
.repositories['libs']
.resolveLibrary('jdk')
.binaries
.withType(SharedLibraryBinary)
.findResults { it.sharedLibraryLinkFile }
*.parentFile
.each { linker.args "-Wl,-rpath=$it" }
}
def libDir = $.repositories['libs'].resolveLibrary('jdk')
.binaries.withType(SharedLibraryBinary)
.find { it.targetPlatform.name == targetPlatform.name }
.sharedLibraryLinkFile.parent
linker.args "-Wl,-rpath,$libDir"
}
}
}

View File

@ -63,7 +63,7 @@ public abstract class CrossLanguageSSAPropagationCallGraphBuilder extends AstSSA
@Override
protected InterestingVisitor makeInterestingVisitor(CGNode node, int vn) {
return interesting.get(getLanguage(node), new Integer(vn));
return interesting.get(getLanguage(node), Integer.valueOf(vn));
}
@Override

View File

@ -653,7 +653,7 @@ public class SSAConversion extends AbstractSSAConversion {
if (lexicalUses != null) {
System.err.print(("extra uses for " + instructions[i] + ": "));
for (int lexicalUse : lexicalUses) {
System.err.print((new Integer(lexicalUse).toString() + " "));
System.err.print((Integer.valueOf(lexicalUse).toString() + " "));
}
System.err.println("");
}

View File

@ -2700,7 +2700,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
@Override
public final int setValue(CAstNode n, int v) {
results.put(n, new Integer(v));
results.put(n, Integer.valueOf(v));
return v;
}
@ -3551,7 +3551,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
+ " of loop " + CAstPrinter.print(n, context.top().getSourceMap());
context.cfg().addInstruction(
insts.ConditionalBranchInstruction(context.cfg().currentInstruction, translateConditionOpcode(CAstOperator.OP_EQ), null, c.getValue(n.getChild(0)), context
.currentScope().getConstantValue(new Integer(0)), -1));
.currentScope().getConstantValue(Integer.valueOf(0)), -1));
PreBasicBlock branchB = context.cfg().getCurrentBlock();
// loop body
@ -3845,7 +3845,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
CAstNode arg = n.getChild(0);
context.cfg().addInstruction(
insts.ConditionalBranchInstruction(currentInstruction, translateConditionOpcode(CAstOperator.OP_NE), null, c.getValue(arg), context
.currentScope().getConstantValue(new Integer(0)), -1));
.currentScope().getConstantValue(Integer.valueOf(0)), -1));
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(arg));
} else if (n.getChildCount() == 3) {
CAstNode op = n.getChild(0);
@ -3909,7 +3909,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
int currentInstruction = context.cfg().getCurrentInstruction();
context.cfg().addInstruction(
insts.ConditionalBranchInstruction(currentInstruction, translateConditionOpcode(CAstOperator.OP_EQ), null, c.getValue(l), context.currentScope()
.getConstantValue(new Integer(0)), -1));
.getConstantValue(Integer.valueOf(0)), -1));
context.cfg().noteOperands(currentInstruction, context.getSourceMap().getPosition(l));
PreBasicBlock srcB = context.cfg().getCurrentBlock();
// true clause
@ -4049,7 +4049,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
protected void leaveArrayLiteralInitElement(CAstNode n, int i, WalkContext c, CAstVisitor<WalkContext> visitor) {
WalkContext context = c;
arrayOpHandler.doArrayWrite(context, c.getValue(n.getChild(0)), n,
new int[] { context.currentScope().getConstantValue(new Integer(i - 1)) }, c.getValue(n.getChild(i)));
new int[] { context.currentScope().getConstantValue(Integer.valueOf(i - 1)) }, c.getValue(n.getChild(i)));
}
@Override

View File

@ -186,32 +186,32 @@ public class CAstImpl implements CAst {
@Override
public CAstNode makeConstant(char value) {
return makeConstant(new Character(value));
return makeConstant(Character.valueOf(value));
}
@Override
public CAstNode makeConstant(short value) {
return makeConstant(new Short(value));
return makeConstant(Short.valueOf(value));
}
@Override
public CAstNode makeConstant(int value) {
return makeConstant(new Integer(value));
return makeConstant(Integer.valueOf(value));
}
@Override
public CAstNode makeConstant(long value) {
return makeConstant(new Long(value));
return makeConstant(Long.valueOf(value));
}
@Override
public CAstNode makeConstant(float value) {
return makeConstant(new Float(value));
return makeConstant(Float.valueOf(value));
}
@Override
public CAstNode makeConstant(double value) {
return makeConstant(new Double(value));
return makeConstant(Double.valueOf(value));
}
}

View File

@ -17,12 +17,13 @@ org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
org.eclipse.jdt.core.compiler.problem.deadCode=error
org.eclipse.jdt.core.compiler.problem.deprecation=error
org.eclipse.jdt.core.compiler.problem.deprecation=ignore
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
@ -91,6 +92,7 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=enabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=ignore

View File

@ -206,8 +206,9 @@ public class PruneArrayOutOfBoundExceptionEdge {
SSAInstruction lastInstruction = block.getLastInstruction();
lastInstruction.getExceptionTypes();
Matcher<Iterable<? super TypeReference>> matcher1 = anyOf(hasItem(equalTo(TypeReference.JavaLangNullPointerException)),
hasItem(equalTo(TypeReference.JavaLangArrayIndexOutOfBoundsException)));
final Matcher<Iterable<? super TypeReference>> isJLNPE = hasItem(equalTo(TypeReference.JavaLangNullPointerException));
final Matcher<Iterable<? super TypeReference>> isJLAIOOBE = hasItem(equalTo(TypeReference.JavaLangArrayIndexOutOfBoundsException));
final Matcher<Iterable<? super TypeReference>> matcher1 = anyOf(isJLNPE, isJLAIOOBE);
collector.checkThat("Edge deleted but cause instruction can't throw NullPointerException"
+ "nor ArrayIndexOutOfBoundsException: " + identifyer + ":" + method.getLineNumber(lastInstruction.iindex),

View File

@ -601,21 +601,21 @@ public class PrimitivesTest extends WalaTestCase {
@Test public void testSmallMap() {
SmallMap<Integer, Integer> M = new SmallMap<>();
Integer I1 = new Integer(1);
Integer I2 = new Integer(2);
Integer I3 = new Integer(3);
Integer I1 = Integer.valueOf(1);
Integer I2 = Integer.valueOf(2);
Integer I3 = Integer.valueOf(3);
M.put(I1, I1);
M.put(I2, I2);
M.put(I3, I3);
Integer I = M.get(new Integer(2));
Integer I = M.get(Integer.valueOf(2));
Assert.assertTrue(I != null);
Assert.assertTrue(I.equals(I2));
I = M.get(new Integer(4));
I = M.get(Integer.valueOf(4));
Assert.assertTrue(I == null);
I = M.put(new Integer(2), new Integer(3));
I = M.put(Integer.valueOf(2), Integer.valueOf(3));
Assert.assertTrue(I.equals(I2));
I = M.get(I2);
Assert.assertTrue(I.equals(I3));
@ -623,24 +623,24 @@ public class PrimitivesTest extends WalaTestCase {
@Test public void testBimodalMap() {
Map<Integer, Integer> M = new BimodalMap<>(3);
Integer I1 = new Integer(1);
Integer I2 = new Integer(2);
Integer I3 = new Integer(3);
Integer I4 = new Integer(4);
Integer I5 = new Integer(5);
Integer I6 = new Integer(6);
Integer I1 = Integer.valueOf(1);
Integer I2 = Integer.valueOf(2);
Integer I3 = Integer.valueOf(3);
Integer I4 = Integer.valueOf(4);
Integer I5 = Integer.valueOf(5);
Integer I6 = Integer.valueOf(6);
M.put(I1, I1);
M.put(I2, I2);
M.put(I3, I3);
Integer I = M.get(new Integer(2));
Integer I = M.get(Integer.valueOf(2));
Assert.assertTrue(I != null);
Assert.assertTrue(I.equals(I2));
I = M.get(new Integer(4));
I = M.get(Integer.valueOf(4));
Assert.assertTrue(I == null);
I = M.put(new Integer(2), new Integer(3));
I = M.put(Integer.valueOf(2), Integer.valueOf(3));
Assert.assertTrue(I.equals(I2));
I = M.get(I2);
Assert.assertTrue(I.equals(I3));
@ -648,14 +648,14 @@ public class PrimitivesTest extends WalaTestCase {
M.put(I4, I4);
M.put(I5, I5);
M.put(I6, I6);
I = M.get(new Integer(4));
I = M.get(Integer.valueOf(4));
Assert.assertTrue(I != null);
Assert.assertTrue(I.equals(I4));
I = M.get(new Integer(7));
I = M.get(Integer.valueOf(7));
Assert.assertTrue(I == null);
I = M.put(new Integer(2), new Integer(6));
I = M.put(Integer.valueOf(2), Integer.valueOf(6));
Assert.assertTrue(I.equals(I3));
I = M.get(I2);
Assert.assertTrue(I.equals(I6));
@ -714,7 +714,7 @@ public class PrimitivesTest extends WalaTestCase {
// add 10 nodes
Integer[] nodes = new Integer[10];
for (int i = 0; i < nodes.length; i++)
G.addNode(nodes[i] = new Integer(i));
G.addNode(nodes[i] = Integer.valueOf(i));
// edges to i-1, i+1, i+2
for (int i = 0; i < nodes.length; i++) {
@ -738,7 +738,7 @@ public class PrimitivesTest extends WalaTestCase {
// add nodes
Object[] nodes = new Object[11];
for (int i = 0; i < nodes.length; i++)
G.addNode(nodes[i] = new Integer(i));
G.addNode(nodes[i] = Integer.valueOf(i));
// add edges
G.addEdge(nodes[10], nodes[0]);
@ -861,7 +861,7 @@ public class PrimitivesTest extends WalaTestCase {
private static int countEquivalenceClasses(IntegerUnionFind uf) {
HashSet<Integer> s = HashSetFactory.make();
for (int i = 0; i < uf.size(); i++) {
s.add(new Integer(uf.find(i)));
s.add(Integer.valueOf(uf.find(i)));
}
return s.size();
}

View File

@ -71,7 +71,7 @@ public abstract class AbstractReflectionInterpreter implements SSAContextInterpr
protected int getLocalForType(TypeReference T) {
Integer I = typeIndexMap.get(T);
if (I == null) {
typeIndexMap.put(T, I = new Integer(indexLocal += 2));
typeIndexMap.put(T, I = Integer.valueOf(indexLocal += 2));
}
return I.intValue();
}

View File

@ -632,7 +632,7 @@ public class FactoryBypassInterpreter extends AbstractReflectionInterpreter {
Map<Integer, ConstantValue> constants = null;
if (valueNumberForConstantOne > -1) {
constants = HashMapFactory.make(1);
constants.put(new Integer(valueNumberForConstantOne), new ConstantValue(new Integer(1)));
constants.put(Integer.valueOf(valueNumberForConstantOne), new ConstantValue(Integer.valueOf(1)));
}
return new SyntheticIR(this, context, new InducedCFG(instrs, this, context), instrs, options, constants);

View File

@ -187,7 +187,7 @@ public class ReflectiveInvocationInterpreter extends AbstractReflectionInterpret
for (int j = nextArg; j < nargs; j++) {
// load the next parameter into v_temp.
int indexConst = nextLocal++;
constants.put(new Integer(indexConst), new ConstantValue(nextParameter++));
constants.put(Integer.valueOf(indexConst), new ConstantValue(nextParameter++));
int temp = nextLocal++;
m.addInstruction(null, insts.ArrayLoadInstruction(m.allInstructions.size(), temp, parametersVn, indexConst, TypeReference.JavaLangObject), false);
pc++;

View File

@ -520,7 +520,7 @@ public class TypeInference extends SSAInference<TypeVariable> implements FixedPo
if (!doPrimitives) {
result = null;
} else {
result = new DeclaredTypeOperator(language.getPrimitive(language.getConstantType(new Integer(1))));
result = new DeclaredTypeOperator(language.getPrimitive(language.getConstantType(Integer.valueOf(1))));
}
}
@ -622,7 +622,7 @@ public class TypeInference extends SSAInference<TypeVariable> implements FixedPo
@Override
public void visitComparison(SSAComparisonInstruction instruction) {
if (doPrimitives) {
result = new DeclaredTypeOperator(language.getPrimitive(language.getConstantType(new Integer(0))));
result = new DeclaredTypeOperator(language.getPrimitive(language.getConstantType(Integer.valueOf(0))));
}
}

View File

@ -236,9 +236,9 @@ public class ZeroXInstanceKeys implements InstanceKeyFactory {
if (alloc != null) {
Integer old = count.get(alloc);
if (old == null) {
count.put(alloc, new Integer(1));
count.put(alloc, Integer.valueOf(1));
} else {
count.put(alloc, new Integer(old.intValue() + 1));
count.put(alloc, Integer.valueOf(old.intValue() + 1));
}
}
}

View File

@ -828,7 +828,7 @@ public class PDG<T extends InstanceKey> implements NumberedGraph<Statement> {
for (int i = 0; i < instructions.length; i++) {
SSAInstruction s = instructions[i];
if (s != null) {
result.put(s, new Integer(i));
result.put(s, Integer.valueOf(i));
}
}
}

View File

@ -38,7 +38,7 @@ public class ReflectionSummary {
}
private Set<TypeReference> findOrCreateSetForBCIndex(int bcIndex) {
Integer I = new Integer(bcIndex);
Integer I = Integer.valueOf(bcIndex);
Set<TypeReference> result = map.get(I);
if (result == null) {
result = HashSetFactory.make(10);
@ -51,7 +51,7 @@ public class ReflectionSummary {
if (cha == null) {
throw new IllegalArgumentException("null cha");
}
Set<TypeReference> S = map.get(new Integer(bcIndex));
Set<TypeReference> S = map.get(Integer.valueOf(bcIndex));
if (S == null) {
return null;
} else {
@ -68,6 +68,6 @@ public class ReflectionSummary {
}
public Set<TypeReference> getTypesForProgramLocation(int bcIndex) {
return map.get(new Integer(bcIndex));
return map.get(Integer.valueOf(bcIndex));
}
}

View File

@ -106,8 +106,8 @@ public class SyntheticIR extends IR {
for (int j = 0; j < s.getNumberOfUses(); j++) {
int vn = s.getUse(j);
symbolTable.ensureSymbol(vn);
if (constants != null && constants.containsKey(new Integer(vn)))
symbolTable.setConstantValue(vn, constants.get(new Integer(vn)));
if (constants != null && constants.containsKey(Integer.valueOf(vn)))
symbolTable.setConstantValue(vn, constants.get(Integer.valueOf(vn)));
}
}

View File

@ -123,22 +123,22 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
private final static Map<String, Integer> elementMap = HashMapFactory.make(14);
static {
elementMap.put("classloader", new Integer(E_CLASSLOADER));
elementMap.put("method", new Integer(E_METHOD));
elementMap.put("class", new Integer(E_CLASS));
elementMap.put("package", new Integer(E_PACKAGE));
elementMap.put("call", new Integer(E_CALL));
elementMap.put("new", new Integer(E_NEW));
elementMap.put("poison", new Integer(E_POISON));
elementMap.put("summary-spec", new Integer(E_SUMMARY_SPEC));
elementMap.put("return", new Integer(E_RETURN));
elementMap.put("putstatic", new Integer(E_PUTSTATIC));
elementMap.put("aastore", new Integer(E_AASTORE));
elementMap.put("putfield", new Integer(E_PUTFIELD));
elementMap.put("getfield", new Integer(E_GETFIELD));
elementMap.put("throw", new Integer(E_ATHROW));
elementMap.put("constant", new Integer(E_CONSTANT));
elementMap.put("aaload", new Integer(E_AALOAD));
elementMap.put("classloader", Integer.valueOf(E_CLASSLOADER));
elementMap.put("method", Integer.valueOf(E_METHOD));
elementMap.put("class", Integer.valueOf(E_CLASS));
elementMap.put("package", Integer.valueOf(E_PACKAGE));
elementMap.put("call", Integer.valueOf(E_CALL));
elementMap.put("new", Integer.valueOf(E_NEW));
elementMap.put("poison", Integer.valueOf(E_POISON));
elementMap.put("summary-spec", Integer.valueOf(E_SUMMARY_SPEC));
elementMap.put("return", Integer.valueOf(E_RETURN));
elementMap.put("putstatic", Integer.valueOf(E_PUTSTATIC));
elementMap.put("aastore", Integer.valueOf(E_AASTORE));
elementMap.put("putfield", Integer.valueOf(E_PUTFIELD));
elementMap.put("getfield", Integer.valueOf(E_GETFIELD));
elementMap.put("throw", Integer.valueOf(E_ATHROW));
elementMap.put("constant", Integer.valueOf(E_CONSTANT));
elementMap.put("aaload", Integer.valueOf(E_AALOAD));
}
//
@ -493,7 +493,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
}
int defNum = nextLocal;
symbolTable.put(defVar, new Integer(nextLocal++));
symbolTable.put(defVar, Integer.valueOf(nextLocal++));
governingMethod.addStatement(insts.InvokeInstruction(governingMethod.getNumberOfStatements(), defNum, params, exceptionValue, site, null));
} else {
@ -526,7 +526,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
defVar = "L" + nextLocal;
}
int defNum = nextLocal;
symbolTable.put(defVar, new Integer(nextLocal++));
symbolTable.put(defVar, Integer.valueOf(nextLocal++));
// create the allocation statement and add it to the method summary
NewSiteReference ref = NewSiteReference.make(governingMethod.getNextProgramCounter(), type);
@ -602,7 +602,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
Assertions.UNREACHABLE("Must specify def for getfield " + governingMethod);
}
int defNum = nextLocal;
symbolTable.put(defVar, new Integer(nextLocal++));
symbolTable.put(defVar, Integer.valueOf(nextLocal++));
// get the ref read from
String R = atts.getValue(A_REF);
@ -778,7 +778,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
Assertions.UNREACHABLE("Must specify def for getfield " + governingMethod);
}
int defNum = nextLocal;
symbolTable.put(defVar, new Integer(nextLocal++));
symbolTable.put(defVar, Integer.valueOf(nextLocal++));
SSAArrayLoadInstruction S = insts.ArrayLoadInstruction(governingMethod.getNumberOfStatements(), defNum, refNumber.intValue(), 0,
type);
governingMethod.addStatement(S);
@ -806,7 +806,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
} else {
valueNumber = symbolTable.get(V_NULL);
if (valueNumber == null) {
valueNumber = new Integer(nextLocal++);
valueNumber = Integer.valueOf(nextLocal++);
symbolTable.put(V_NULL, valueNumber);
}
}
@ -825,17 +825,17 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
String var = atts.getValue(A_NAME);
if (var == null)
Assertions.UNREACHABLE("Must give name for constant");
Integer valueNumber = new Integer(nextLocal++);
Integer valueNumber = Integer.valueOf(nextLocal++);
symbolTable.put(var, valueNumber);
String typeString = atts.getValue(A_TYPE);
String valueString = atts.getValue(A_VALUE);
governingMethod.addConstant(valueNumber, (typeString.equals("int")) ? new ConstantValue(new Integer(valueString))
: (typeString.equals("long")) ? new ConstantValue(new Long(valueString))
: (typeString.equals("short")) ? new ConstantValue(new Short(valueString))
: (typeString.equals("float")) ? new ConstantValue(new Float(valueString))
: (typeString.equals("double")) ? new ConstantValue(new Double(valueString)) : null);
governingMethod.addConstant(valueNumber, (typeString.equals("int")) ? new ConstantValue(Integer.valueOf(valueString))
: (typeString.equals("long")) ? new ConstantValue(Long.valueOf(valueString))
: (typeString.equals("short")) ? new ConstantValue(Short.valueOf(valueString))
: (typeString.equals("float")) ? new ConstantValue(Float.valueOf(valueString))
: (typeString.equals("double")) ? new ConstantValue(Double.valueOf(valueString)) : null);
}
/**
@ -925,7 +925,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
symbolTable = HashMapFactory.make(5);
// create symbols for the parameters
for (int i = 0; i < nParams; i++) {
symbolTable.put("arg" + i, new Integer(i + 1));
symbolTable.put("arg" + i, Integer.valueOf(i + 1));
}
int pn = 1;

View File

@ -21,11 +21,11 @@ public class ConstantValue implements Value {
}
public ConstantValue(int constant) {
this(new Integer(constant));
this(Integer.valueOf(constant));
}
public ConstantValue(double constant) {
this(new Double(constant));
this(Double.valueOf(constant));
}

View File

@ -125,10 +125,10 @@ public abstract class IR implements IRView {
callSiteMapping.add(((SSAAbstractInvokeInstruction) x).getCallSite().getProgramCounter(), i);
}
if (x instanceof SSANewInstruction) {
newSiteMapping.put(((SSANewInstruction) x).getNewSite(), new Integer(i));
newSiteMapping.put(((SSANewInstruction) x).getNewSite(), Integer.valueOf(i));
}
if (x.isPEI()) {
peiMapping.put(new ProgramCounter(cfg.getProgramCounter(i)), new Integer(i));
peiMapping.put(new ProgramCounter(cfg.getProgramCounter(i)), Integer.valueOf(i));
}
}
}

View File

@ -147,11 +147,11 @@ public class SymbolTable implements Cloneable {
}
public int getConstant(float f) {
return findOrCreateConstant(new Float(f));
return findOrCreateConstant(Float.valueOf(f));
}
public int getConstant(double d) {
return findOrCreateConstant(new Double(d));
return findOrCreateConstant(Double.valueOf(d));
}
public int getConstant(String s) {

View File

@ -110,7 +110,7 @@ public class DeadAssignmentElimination {
int def = phi.getDef();
if (DU.getNumberOfUses(def) == 0) {
// the phi is certainly dead ... record this with a dataflow fact.
trivialDead.add(new Integer(def));
trivialDead.add(Integer.valueOf(def));
} else {
boolean maybeDead = true;
for (SSAInstruction u : Iterator2Iterable.make(DU.getUses(def))) {
@ -123,7 +123,7 @@ public class DeadAssignmentElimination {
if (maybeDead) {
// perhaps the phi is dead .. create a variable
BooleanVariable B = new BooleanVariable(false);
vars.put(new Integer(def), B);
vars.put(Integer.valueOf(def), B);
}
}
}
@ -134,7 +134,7 @@ public class DeadAssignmentElimination {
BooleanVariable B = E.getValue();
for (SSAInstruction use : Iterator2Iterable.make(DU.getUses(def.intValue()))) {
SSAPhiInstruction u = (SSAPhiInstruction) use;
Integer ud = new Integer(u.getDef());
Integer ud = Integer.valueOf(u.getDef());
if (trivialDead.contains(ud)) {
// do nothing ... u will not keep def live
} else {

View File

@ -203,7 +203,7 @@ public class AppModelMethod {
nextLocal = nParams + 1;
symbolTable = HashMapFactory.make(5);
for (int i = 0; i < nParams; i++) {
symbolTable.put("arg" + i, new Integer(i + 1));
symbolTable.put("arg" + i, Integer.valueOf(i + 1));
}
}

View File

@ -382,16 +382,16 @@ public class OfflineDynamicCallGraph {
final byte itemType = p.getItemType(i);
switch (itemType) {
case CONSTANT_Integer:
entries.put(new Integer(p.getCPInt(i)), i);
entries.put(Integer.valueOf(p.getCPInt(i)), i);
break;
case CONSTANT_Long:
entries.put(new Long(p.getCPLong(i)), i);
entries.put(Long.valueOf(p.getCPLong(i)), i);
break;
case CONSTANT_Float:
entries.put(new Float(p.getCPFloat(i)), i);
entries.put(Float.valueOf(p.getCPFloat(i)), i);
break;
case CONSTANT_Double:
entries.put(new Double(p.getCPDouble(i)), i);
entries.put(Double.valueOf(p.getCPDouble(i)), i);
break;
case CONSTANT_Utf8:
entries.put(p.getCPUtf8(i), i);

View File

@ -318,7 +318,7 @@ public abstract class ConstantInstruction extends Instruction {
@Override
final public Object getValue() {
return new Float(getFloatValue());
return Float.valueOf(getFloatValue());
}
@Override
@ -390,7 +390,7 @@ public abstract class ConstantInstruction extends Instruction {
@Override
final public Object getValue() {
return new Double(getDoubleValue());
return Double.valueOf(getDoubleValue());
}
@Override

View File

@ -55,16 +55,16 @@ public abstract class Decoder implements Constants {
table[OP_aconst_null] = ConstantInstruction.make(TYPE_null, null);
for (int i = OP_iconst_m1; i <= OP_iconst_5; i++) {
table[i] = ConstantInstruction.make(TYPE_int, new Integer(i - OP_iconst_m1 - 1));
table[i] = ConstantInstruction.make(TYPE_int, Integer.valueOf(i - OP_iconst_m1 - 1));
}
for (int i = OP_lconst_0; i <= OP_lconst_1; i++) {
table[i] = ConstantInstruction.make(TYPE_long, new Long(i - OP_lconst_0));
table[i] = ConstantInstruction.make(TYPE_long, Long.valueOf(i - OP_lconst_0));
}
for (int i = OP_fconst_0; i <= OP_fconst_2; i++) {
table[i] = ConstantInstruction.make(TYPE_float, new Float(i - OP_fconst_0));
table[i] = ConstantInstruction.make(TYPE_float, Float.valueOf(i - OP_fconst_0));
}
for (int i = OP_dconst_0; i <= OP_dconst_1; i++) {
table[i] = ConstantInstruction.make(TYPE_double, new Double(i - OP_dconst_0));
table[i] = ConstantInstruction.make(TYPE_double, Double.valueOf(i - OP_dconst_0));
}
for (int i = OP_iload_0; i <= OP_aload_3; i++) {

View File

@ -113,7 +113,7 @@ public class AddSerialVersion {
for (int f = 0; f < fields.length; f++) {
int flags = r.getFieldAccessFlags(f);
if ((flags & ClassConstants.ACC_PRIVATE) == 0 || (flags & (ClassConstants.ACC_STATIC | ClassConstants.ACC_TRANSIENT)) == 0) {
fields[fieldCount] = new Integer(f);
fields[fieldCount] = Integer.valueOf(f);
fieldNames[f] = r.getFieldName(f);
fieldCount++;
}
@ -139,7 +139,7 @@ public class AddSerialVersion {
String name = r.getMethodName(m);
int flags = r.getMethodAccessFlags(m);
if (name.equals("<clinit>") || (flags & ClassConstants.ACC_PRIVATE) == 0) {
methods[methodCount] = new Integer(m);
methods[methodCount] = Integer.valueOf(m);
methodSigs[m] = name + r.getMethodType(m);
if (name.equals("<clinit>")) {
methodKinds[m] = 0;

View File

@ -265,40 +265,40 @@ public class ClassWriter implements ClassConstants {
byte t = cp.getItemType(i);
switch (t) {
case CONSTANT_String:
cachedCPEntries.put(new CWStringItem(cp.getCPString(i), CONSTANT_String), new Integer(i));
cachedCPEntries.put(new CWStringItem(cp.getCPString(i), CONSTANT_String), Integer.valueOf(i));
break;
case CONSTANT_Class:
cachedCPEntries.put(new CWStringItem(cp.getCPClass(i), CONSTANT_Class), new Integer(i));
cachedCPEntries.put(new CWStringItem(cp.getCPClass(i), CONSTANT_Class), Integer.valueOf(i));
break;
case CONSTANT_MethodType:
cachedCPEntries.put(new CWStringItem(cp.getCPMethodType(i), CONSTANT_MethodType), new Integer(i));
cachedCPEntries.put(new CWStringItem(cp.getCPMethodType(i), CONSTANT_MethodType), Integer.valueOf(i));
break;
case CONSTANT_MethodHandle:
case CONSTANT_FieldRef:
case CONSTANT_InterfaceMethodRef:
case CONSTANT_MethodRef:
cachedCPEntries.put(new CWRef(t, cp.getCPRefClass(i), cp.getCPRefName(i), cp.getCPRefType(i)), new Integer(i));
cachedCPEntries.put(new CWRef(t, cp.getCPRefClass(i), cp.getCPRefName(i), cp.getCPRefType(i)), Integer.valueOf(i));
break;
case CONSTANT_NameAndType:
cachedCPEntries.put(new CWNAT(cp.getCPNATName(i), cp.getCPNATType(i)), new Integer(i));
cachedCPEntries.put(new CWNAT(cp.getCPNATName(i), cp.getCPNATType(i)), Integer.valueOf(i));
break;
case CONSTANT_InvokeDynamic:
cachedCPEntries.put(new CWInvokeDynamic(cp.getCPDynBootstrap(i), cp.getCPDynName(i), cp.getCPDynType(i)), new Integer(i));
cachedCPEntries.put(new CWInvokeDynamic(cp.getCPDynBootstrap(i), cp.getCPDynName(i), cp.getCPDynType(i)), Integer.valueOf(i));
break;
case CONSTANT_Integer:
cachedCPEntries.put(new Integer(cp.getCPInt(i)), new Integer(i));
cachedCPEntries.put(Integer.valueOf(cp.getCPInt(i)), Integer.valueOf(i));
break;
case CONSTANT_Float:
cachedCPEntries.put(new Float(cp.getCPFloat(i)), new Integer(i));
cachedCPEntries.put(Float.valueOf(cp.getCPFloat(i)), Integer.valueOf(i));
break;
case CONSTANT_Long:
cachedCPEntries.put(new Long(cp.getCPLong(i)), new Integer(i));
cachedCPEntries.put(Long.valueOf(cp.getCPLong(i)), Integer.valueOf(i));
break;
case CONSTANT_Double:
cachedCPEntries.put(new Double(cp.getCPDouble(i)), new Integer(i));
cachedCPEntries.put(Double.valueOf(cp.getCPDouble(i)), Integer.valueOf(i));
break;
case CONSTANT_Utf8:
cachedCPEntries.put(cp.getCPUtf8(i), new Integer(i));
cachedCPEntries.put(cp.getCPUtf8(i), Integer.valueOf(i));
break;
default:
throw new UnsupportedOperationException(String.format("unexpected constant-pool item type %s", t));
@ -326,7 +326,7 @@ public class ClassWriter implements ClassConstants {
} else {
int index = nextCPIndex;
nextCPIndex += size;
i = new Integer(index);
i = Integer.valueOf(index);
cachedCPEntries.put(o, i);
newCPEntries.add(o);
if (nextCPIndex > 0xFFFF) {
@ -351,7 +351,7 @@ public class ClassWriter implements ClassConstants {
* @return the index of a constant pool item with the right value
*/
public int addCPInt(int i) {
return addCPEntry(new Integer(i), 1);
return addCPEntry(Integer.valueOf(i), 1);
}
/**
@ -360,7 +360,7 @@ public class ClassWriter implements ClassConstants {
* @return the index of a constant pool item with the right value
*/
public int addCPFloat(float f) {
return addCPEntry(new Float(f), 1);
return addCPEntry(Float.valueOf(f), 1);
}
/**
@ -369,7 +369,7 @@ public class ClassWriter implements ClassConstants {
* @return the index of a constant pool item with the right value
*/
public int addCPLong(long l) {
return addCPEntry(new Long(l), 2);
return addCPEntry(Long.valueOf(l), 2);
}
/**
@ -378,7 +378,7 @@ public class ClassWriter implements ClassConstants {
* @return the index of a constant pool item with the right value
*/
public int addCPDouble(double d) {
return addCPEntry(new Double(d), 2);
return addCPEntry(Double.valueOf(d), 2);
}
private int addCPString(String s, byte type) {