1) a bit more source mappimg information

2) fixes to how Contexts are combined
This commit is contained in:
Julian Dolby 2018-10-13 08:42:08 -04:00
parent 31cf42674a
commit b2503628a4
61 changed files with 356 additions and 132 deletions

View File

@ -9,8 +9,13 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
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.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=error

View File

@ -289,8 +289,11 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
private final T fSourcePosition;
private final T fNamePos;
public ClassEntity(ITypeBinding jdtType, String name, Collection<CAstQualifier> quals, Collection<CAstEntity> entities,
T pos) {
T pos, T namePos) {
fNamePos = namePos;
fName = name;
fQuals = quals;
fEntities = entities;
@ -396,6 +399,11 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
return fTypeDict.new JdtJavaType(fJdtType);
}
@Override
public Position getNamePosition() {
return fNamePos;
}
}
private static boolean isInterface(AbstractTypeDeclaration decl) {
@ -405,7 +413,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
private CAstEntity visitTypeDecl(AbstractTypeDeclaration n, WalkContext context) {
return createClassDeclaration(n, n.bodyDeclarations(), null, n.resolveBinding(), n.getName().getIdentifier(), n.getModifiers(),
isInterface(n), n instanceof AnnotationTypeDeclaration, context);
isInterface(n), n instanceof AnnotationTypeDeclaration, context, makePosition(n.getName()));
}
/**
@ -416,10 +424,11 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
* @param typeBinding
* @param name Used in creating default constructor, and passed into new ClassEntity()
* @param context
* @param namePos
*/
private CAstEntity createClassDeclaration(ASTNode n, List<BodyDeclaration> bodyDecls,
List<EnumConstantDeclaration> enumConstants, ITypeBinding typeBinding, String name, int modifiers,
boolean isInterface, boolean isAnnotation, WalkContext context) {
boolean isInterface, boolean isAnnotation, WalkContext context, T namePos) {
final List<CAstEntity> memberEntities = new ArrayList<>();
// find and collect all initializers (type Initializer) and field initializers (type VariableDeclarationFragment).
@ -465,7 +474,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
IVariableBinding fieldBinding = fieldFrag.resolveBinding();
memberEntities.add(new FieldEntity(fieldFrag.getName().getIdentifier(), fieldBinding.getType(), quals,
makePosition(fieldFrag.getStartPosition(), fieldFrag.getStartPosition() + fieldFrag.getLength()),
handleAnnotations(fieldBinding)));
handleAnnotations(fieldBinding), makePosition(fieldFrag.getName())));
}
} else if (decl instanceof Initializer) {
// Initializers are inserted into constructors when making constructors.
@ -526,12 +535,12 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
Collection<CAstQualifier> quals = JDT2CAstUtils.mapModifiersToQualifiers(modifiers, isInterface, isAnnotation);
return new ClassEntity(typeBinding, name, quals, memberEntities, makePosition(n));
return new ClassEntity(typeBinding, name, quals, memberEntities, makePosition(n), namePos);
}
private CAstEntity visit(AnonymousClassDeclaration n, WalkContext context) {
return createClassDeclaration(n, n.bodyDeclarations(), null, n.resolveBinding(),
JDT2CAstUtils.anonTypeName(n.resolveBinding()), 0 /* no modifiers */, false, false, context);
JDT2CAstUtils.anonTypeName(n.resolveBinding()), 0 /* no modifiers */, false, false, context, null);
}
private CAstNode visit(TypeDeclarationStatement n, WalkContext context) {
@ -1106,6 +1115,15 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
SingleVariableDeclaration p = (SingleVariableDeclaration) fDecl.parameters().get(arg);
return makePosition(p);
}
@Override
public Position getNamePosition() {
if (fDecl == null) {
return null;
} else {
return makePosition(fDecl);
}
}
}
// ////////////////////////////////////
@ -1158,13 +1176,16 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
private final T position;
private final T namePos;
private final Set<CAstAnnotation> annotations;
private FieldEntity(String name, ITypeBinding type, Collection<CAstQualifier> quals, T position, Set<CAstAnnotation> annotations) {
private FieldEntity(String name, ITypeBinding type, Collection<CAstQualifier> quals, T position, Set<CAstAnnotation> annotations, T namePos) {
super();
this.type = type;
this.quals = quals;
this.name = name;
this.namePos = namePos;
this.position = position;
this.annotations = annotations;
}
@ -1261,6 +1282,13 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
@Override
public Position getPosition(int arg) {
return namePos;
}
@Override
public Position getNamePosition() {
// TODO Auto-generated method stub
return null;
}
}
@ -3045,6 +3073,11 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
public Position getPosition(int arg) {
return null;
}
@Override
public Position getNamePosition() {
return null;
}
}
// /////////////////////////////
@ -3340,7 +3373,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
*/
private CAstEntity visit(EnumConstantDeclaration decl, WalkContext context) {
return new FieldEntity(decl.getName().getIdentifier(), decl.resolveVariable().getType(), enumQuals, makePosition(decl
.getStartPosition(), decl.getStartPosition() + decl.getLength()), null);
.getStartPosition(), decl.getStartPosition() + decl.getLength()), null, makePosition(decl.getName()));
}
/**
@ -3489,10 +3522,9 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
}
private CAstEntity visit(EnumDeclaration n, WalkContext context) {
// JDT contains correct type info / class / subclass info for the enum
return createClassDeclaration(n, n.bodyDeclarations(), n.enumConstants(), n.resolveBinding(), n.getName().getIdentifier(), n
.resolveBinding().getModifiers(), false, false, context);
.resolveBinding().getModifiers(), false, false, context, makePosition(n.getName()));
}
/**

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -410,6 +410,8 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
private final Position entityPosition;
private final Position namePosition;
private final Position[] paramPositions;
private ScriptOrFnEntity(AstNode n, Map<CAstNode, Collection<CAstEntity>> subs, CAstNode ast, CAstControlFlowMap map, CAstSourcePositionMap pos, String name) {
@ -418,6 +420,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
if (n instanceof FunctionNode) {
FunctionNode f = (FunctionNode) n;
namePosition = makePosition(f.getFunctionName());
f.flattenSymbolTable(false);
int i = 0;
arguments = new String[f.getParamCount() + 2];
@ -436,6 +439,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
} else {
paramPositions = new Position[0];
arguments = new String[0];
namePosition = null;
}
kind = (n instanceof FunctionNode) ? CAstEntity.FUNCTION_ENTITY : CAstEntity.SCRIPT_ENTITY;
this.subs = subs;
@ -538,6 +542,11 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
public Position getPosition(int arg) {
return paramPositions[arg];
}
@Override
public Position getNamePosition() {
return namePosition;
}
}
private CAstEntity walkEntity(final AstNode n, List<CAstNode> body, String name, WalkContext child) {
@ -569,6 +578,7 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
}
private Position makePosition(AstNode n) {
if (n != null) {
URL url = ((SourceModule)sourceModule).getURL();
int line = n.getLineno();
Position pos = new RangePosition(url, line, n.getAbsolutePosition(), n.getAbsolutePosition()+n.getLength());
@ -581,6 +591,9 @@ public class RhinoToAstTranslator implements TranslatorToCAst {
}
return pos;
} else {
return null;
}
}
protected CAstNode noteSourcePosition(WalkContext context, CAstNode n, AstNode p) {

View File

@ -1,7 +1,12 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
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.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -191,4 +191,9 @@ class ExtractedFunction implements CAstEntity {
public Position getPosition(int arg) {
return null;
}
@Override
public Position getNamePosition() {
return null;
}
}

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -130,6 +130,12 @@ public class TestConstantCollector {
// TODO Auto-generated method stub
return null;
}
@Override
public Position getNamePosition() {
// TODO Auto-generated method stub
return null;
}
};
}

View File

@ -148,6 +148,12 @@ public class TestNativeTranslator {
// TODO Auto-generated method stub
return null;
}
@Override
public Position getNamePosition() {
// TODO Auto-generated method stub
return null;
}
};
}
}

View File

@ -504,6 +504,8 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
private static class AstDebuggingInformation implements DebuggingInformation {
private Position codeBodyPosition;
private Position codeBodyNamePosition;
private String[][] valueNumberNames;
private Position[] instructionPositions;
@ -512,7 +514,9 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
private Position[] parameterPositions;
AstDebuggingInformation(Position codeBodyPosition, Position[] instructionPositions, Position[][] operandPositions, Position[] parameterPositions, String[] names) {
AstDebuggingInformation(Position codeBodyNamePosition, Position codeBodyPosition, Position[] instructionPositions, Position[][] operandPositions, Position[] parameterPositions, String[] names) {
this.codeBodyNamePosition = codeBodyNamePosition;
this.codeBodyPosition = codeBodyPosition;
this.instructionPositions = instructionPositions;
@ -536,6 +540,11 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
return codeBodyPosition;
}
@Override
public Position getCodeNamePosition() {
return codeBodyNamePosition;
}
@Override
public Position getInstructionPosition(int instructionOffset) {
return instructionPositions[instructionOffset];
@ -3386,7 +3395,7 @@ public abstract class AstTranslator extends CAstVisitor<AstTranslator.WalkContex
Position[] parameterPositions = getParameterPositions(n);
DebuggingInformation DBG = new AstDebuggingInformation(n.getPosition(), line, operand, parameterPositions, nms);
DebuggingInformation DBG = new AstDebuggingInformation(n.getNamePosition(), n.getPosition(), line, operand, parameterPositions, nms);
// actually make code body
defineFunction(n, parentContext, cfg, symtab, katch, catchTypes, monitor, LI, DBG);

View File

@ -46,6 +46,8 @@ public abstract class AstMethod implements IMethod {
Position getCodeBodyPosition();
Position getCodeNamePosition();
Position getInstructionPosition(int instructionOffset);
String[][] getSourceNamesForValues();

View File

@ -161,6 +161,11 @@ public interface CAstEntity {
*/
CAstSourcePositionMap.Position getPosition();
/**
* The source position of the token denoting this entity's name.
*/
CAstSourcePositionMap.Position getNamePosition();
/**
* The source position of argument 'arg' this entity, if any;
*/

View File

@ -116,4 +116,9 @@ public class DelegatingEntity implements CAstEntity {
return base.getPosition(arg);
}
@Override
public Position getNamePosition() {
return base.getNamePosition();
}
}

View File

@ -35,7 +35,7 @@ public class AstConstantCollector {
Object val = s.getSingle("value").getValue();
if (! bad.contains(var)) {
if (values.containsKey(var)) {
if (!values.get(var).equals(val)) {
if (val == null? values.get(var) != null: !values.get(var).equals(val)) {
values.remove(var);
bad.add(var);
}

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -19,7 +19,6 @@ import sun.java2d.FontSupport;
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
@SuppressWarnings("restriction")
public class Main {
public static void main(String[] args) {

View File

@ -18,7 +18,6 @@ import sun.java2d.FontSupport;
* When analyzed with J2EEClassHierarchy exclusions, the superinterface
* FontSupport should not be found because we exclude sun.java2d.*
*/
@SuppressWarnings("restriction")
public interface YuckyInterface extends FontSupport {

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -18,6 +18,7 @@ import java.util.jar.JarFile;
import org.junit.Test;
import com.ibm.wala.analysis.reflection.java7.MethodHandles;
import com.ibm.wala.classLoader.Language;
import com.ibm.wala.core.tests.shrike.DynamicCallGraphTestBase;
import com.ibm.wala.ipa.callgraph.AnalysisCacheImpl;
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
@ -54,14 +55,17 @@ public class Java7CallGraphTest extends DynamicCallGraphTestBase {
ClassHierarchy cha = ClassHierarchyFactory.make(scope);
Iterable<Entrypoint> entrypoints = com.ibm.wala.ipa.callgraph.impl.Util.makeMainEntrypoints(scope, cha, "Lpack/ocamljavaMain");
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
options.setUseConstantSpecificKeys(true);
IAnalysisCacheView cache = new AnalysisCacheImpl();
SSAPropagationCallGraphBuilder builder = Util.makeZeroOneContainerCFABuilder(options, cache, cha, scope);
SSAPropagationCallGraphBuilder builder = Util.makeZeroCFABuilder(Language.JAVA, options, cache, cha, scope);
MethodHandles.analyzeMethodHandles(options, builder);
CallGraph cg = builder.makeCallGraph(options, null);
System.err.println(cg);
instrument(F.getAbsolutePath());
run("pack.ocamljavaMain", null, args);

View File

@ -53,6 +53,7 @@ public class KawaCallGraphTest extends DynamicCallGraphTestBase {
Set<CGNode> color = getNodes(CG, "Lchess", "startingColor", "(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;");
assert ! color.isEmpty();
System.out.println(CG);
}
@Test
@ -78,7 +79,7 @@ public class KawaCallGraphTest extends DynamicCallGraphTestBase {
AnalysisOptions options = CallGraphTestUtil.makeAnalysisOptions(scope, entrypoints);
IAnalysisCacheView cache = new AnalysisCacheImpl();
options.setReflectionOptions(ReflectionOptions.NONE);
options.setReflectionOptions(ReflectionOptions.STRING_ONLY);
options.setTraceStringConstants(true);
options.setUseConstantSpecificKeys(true);

View File

@ -29,6 +29,7 @@ import com.ibm.wala.ipa.callgraph.AnalysisScope;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextKey;
import com.ibm.wala.ipa.callgraph.Entrypoint;
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
import com.ibm.wala.ipa.callgraph.propagation.ConstantKey;
@ -278,9 +279,8 @@ public class ReflectionTest extends WalaTestCase {
for (CGNode node : mainChildren) {
Context context = node.getContext();
if (context instanceof ReceiverInstanceContext && node.getMethod().getReference().equals(newInstanceMr)) {
ReceiverInstanceContext r = (ReceiverInstanceContext) context;
ConstantKey<IMethod> c = (ConstantKey<IMethod>) r.getReceiver();
if (context.isA(ReceiverInstanceContext.class) && node.getMethod().getReference().equals(newInstanceMr)) {
ConstantKey<IMethod> c = (ConstantKey<IMethod>) context.get(ContextKey.RECEIVER);
IMethod ctor = c.getValue();
if (ctor.getSignature().equals(fpInitSig)) {
filePermConstrNewInstanceNode = node;
@ -377,6 +377,7 @@ public class ReflectionTest extends WalaTestCase {
TypeReference tr = TypeReference.findOrCreate(ClassLoaderReference.Primordial, "Ljava/lang/Integer");
MethodReference mr = MethodReference.findOrCreate(tr, "toString", "()Ljava/lang/String;");
Set<CGNode> nodes = cg.getNodes(mr);
System.err.println(cg);
Assert.assertFalse(nodes.isEmpty());
}

View File

@ -208,7 +208,7 @@ public abstract class DynamicCallGraphTestBase extends WalaTestCase {
if (! filter.test(callerRef)) {
continue loop;
}
Assert.assertEquals(callerMethod, 1, nodes.size());
Assert.assertEquals(callerRef.toString(), 1, nodes.size());
caller = nodes.iterator().next();
}

View File

@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import com.ibm.wala.analysis.typeInference.TypeAbstraction;
import com.ibm.wala.cfg.ControlFlowGraph;
import com.ibm.wala.cfg.InducedCFG;
import com.ibm.wala.classLoader.CallSiteReference;
@ -21,6 +22,8 @@ import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.classLoader.NewSiteReference;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextKey;
import com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter;
import com.ibm.wala.ipa.summaries.SyntheticIR;
import com.ibm.wala.ssa.DefUse;
@ -63,7 +66,7 @@ public class ClassFactoryContextInterpreter implements SSAContextInterpreter {
/** BEGIN Custom change: caching */
final JavaTypeContext context = (JavaTypeContext) node.getContext();
final Context context = node.getContext();
final IMethod method = node.getMethod();
final String hashKey = method.toString() + "@" + context.toString();
@ -97,7 +100,7 @@ public class ClassFactoryContextInterpreter implements SSAContextInterpreter {
if (node == null) {
throw new IllegalArgumentException("node is null");
}
if (!(node.getContext() instanceof JavaTypeContext)) {
if (!(node.getContext().isA(JavaTypeContext.class))) {
return false;
}
return ClassFactoryContextSelector.isClassFactory(node.getMethod().getReference());
@ -112,8 +115,7 @@ public class ClassFactoryContextInterpreter implements SSAContextInterpreter {
throw new IllegalArgumentException("node is null");
}
assert understands(node);
JavaTypeContext context = (JavaTypeContext) node.getContext();
TypeReference tr = context.getType().getTypeReference();
TypeReference tr = ((TypeAbstraction)node.getContext().get(ContextKey.RECEIVER)).getTypeReference();
if (tr != null) {
return new NonNullSingletonIterator<>(NewSiteReference.make(0, tr));
}
@ -129,12 +131,12 @@ public class ClassFactoryContextInterpreter implements SSAContextInterpreter {
return EmptyIterator.instance();
}
private static SSAInstruction[] makeStatements(JavaTypeContext context) {
SSAInstructionFactory insts = context.getType().getType().getClassLoader().getInstructionFactory();
private static SSAInstruction[] makeStatements(Context context) {
SSAInstructionFactory insts = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType().getClassLoader().getInstructionFactory();
ArrayList<SSAInstruction> statements = new ArrayList<>();
// vn1 is the string parameter
int retValue = 2;
TypeReference tr = context.getType().getTypeReference();
TypeReference tr = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getTypeReference();
if (tr != null) {
SSALoadMetadataInstruction l = insts.LoadMetadataInstruction(statements.size(), retValue, TypeReference.JavaLangClass, tr);
statements.add(l);
@ -149,7 +151,7 @@ public class ClassFactoryContextInterpreter implements SSAContextInterpreter {
return result;
}
private static IR makeIR(IMethod method, JavaTypeContext context) {
private static IR makeIR(IMethod method, Context context) {
SSAInstruction instrs[] = makeStatements(context);
return new SyntheticIR(method, context, new InducedCFG(instrs, method, context), instrs, SSAOptions.defaultOptions(), null);
}

View File

@ -13,10 +13,12 @@ package com.ibm.wala.analysis.reflection;
import com.ibm.wala.analysis.typeInference.PointType;
import com.ibm.wala.classLoader.CallSiteReference;
import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IClassLoader;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextSelector;
import com.ibm.wala.ipa.callgraph.propagation.ConstantKey;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.ssa.IR;
@ -103,19 +105,35 @@ class ClassFactoryContextSelector implements ContextSelector {
return new JavaTypeContext(new PointType(klass));
}
}
int nameVn = callee.isStatic()? 0: 1;
if (receiver != null && receiver.length > nameVn) {
if (receiver[nameVn] instanceof ConstantKey) {
ConstantKey ik = (ConstantKey) receiver[nameVn];
if (ik.getConcreteType().getReference().equals(TypeReference.JavaLangString)) {
String className = StringStuff.deployment2CanonicalTypeString(ik.getValue().toString());
for(IClassLoader cl : caller.getClassHierarchy().getLoaders()) {
TypeReference t = TypeReference.findOrCreate(cl.getReference(), className);
IClass klass = caller.getClassHierarchy().lookupClass(t);
if (klass != null) {
return new JavaTypeContext(new PointType(klass));
}
}
}
}
}
}
return null;
}
private static final IntSet thisParameter = IntSetUtil.make(new int[]{0});
private static final IntSet firstParameter = IntSetUtil.make(new int[]{1});
private static final IntSet firstParameter = IntSetUtil.make(new int[]{0, 1});
@Override
public IntSet getRelevantParameters(CGNode caller, CallSiteReference site) {
if (isClassFactory(site.getDeclaredTarget())) {
SSAAbstractInvokeInstruction[] invokeInstructions = caller.getIR().getCalls(site);
if (invokeInstructions.length != 1) {
if (invokeInstructions.length >= 1) {
if (invokeInstructions[0].isStatic()) {
return thisParameter;
} else {

View File

@ -13,6 +13,7 @@ package com.ibm.wala.analysis.reflection;
import java.util.Iterator;
import java.util.Map;
import com.ibm.wala.analysis.typeInference.TypeAbstraction;
import com.ibm.wala.cfg.ControlFlowGraph;
import com.ibm.wala.cfg.InducedCFG;
import com.ibm.wala.classLoader.CallSiteReference;
@ -20,6 +21,8 @@ import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.classLoader.NewSiteReference;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextKey;
import com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.ipa.summaries.SyntheticIR;
@ -81,7 +84,7 @@ public class ClassNewInstanceContextInterpreter extends AbstractReflectionInterp
}
/** BEGIN Custom change: caching */
final JavaTypeContext context = (JavaTypeContext) node.getContext();
final Context context = node.getContext();
final IMethod method = node.getMethod();
final String hashKey = method.toString() + "@" + context.toString();
@ -112,7 +115,7 @@ public class ClassNewInstanceContextInterpreter extends AbstractReflectionInterp
if (node == null) {
throw new IllegalArgumentException("node is null");
}
if (!(node.getContext() instanceof JavaTypeContext)) {
if (!(node.getContext().isA(JavaTypeContext.class))) {
return false;
}
return node.getMethod().getReference().equals(CLASS_NEW_INSTANCE_REF);
@ -124,8 +127,8 @@ public class ClassNewInstanceContextInterpreter extends AbstractReflectionInterp
throw new IllegalArgumentException("node is null");
}
assert understands(node);
JavaTypeContext context = (JavaTypeContext) node.getContext();
TypeReference tr = context.getType().getTypeReference();
Context context = node.getContext();
TypeReference tr = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getTypeReference();
if (tr != null) {
return new NonNullSingletonIterator<>(NewSiteReference.make(0, tr));
}
@ -138,9 +141,9 @@ public class ClassNewInstanceContextInterpreter extends AbstractReflectionInterp
return EmptyIterator.instance();
}
private IR makeIR(IMethod method, JavaTypeContext context) {
SSAInstructionFactory insts = context.getType().getType().getClassLoader().getInstructionFactory();
TypeReference tr = context.getType().getTypeReference();
private IR makeIR(IMethod method, Context context) {
SSAInstructionFactory insts = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType().getClassLoader().getInstructionFactory();
TypeReference tr = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getTypeReference();
if (tr != null) {
SpecializedMethod m = new SpecializedMethod(method, method.getDeclaringClass(), method.isStatic(), false);
IClass klass = cha.lookupClass(tr);

View File

@ -14,6 +14,7 @@ import java.util.ArrayList;
import java.util.Iterator;
import java.util.Map;
import com.ibm.wala.analysis.typeInference.TypeAbstraction;
import com.ibm.wala.cfg.ControlFlowGraph;
import com.ibm.wala.cfg.InducedCFG;
import com.ibm.wala.classLoader.CallSiteReference;
@ -21,6 +22,8 @@ import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.classLoader.NewSiteReference;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextKey;
import com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter;
import com.ibm.wala.ipa.summaries.SyntheticIR;
import com.ibm.wala.ssa.DefUse;
@ -59,7 +62,7 @@ public class GetClassContextInterpeter implements SSAContextInterpreter {
}
/** BEGIN Custom change: caching */
final JavaTypeContext context = (JavaTypeContext) node.getContext();
final Context context = node.getContext();
final IMethod method = node.getMethod();
final String hashKey = method.toString() + "@" + context.toString();
@ -90,7 +93,7 @@ public class GetClassContextInterpeter implements SSAContextInterpreter {
if (node == null) {
throw new IllegalArgumentException("node is null");
}
if (!(node.getContext() instanceof JavaTypeContext)) {
if (!(node.getContext().isA(JavaTypeContext.class))) {
return false;
}
return node.getMethod().getReference().equals(GetClassContextSelector.GET_CLASS);
@ -106,12 +109,12 @@ public class GetClassContextInterpeter implements SSAContextInterpreter {
return EmptyIterator.instance();
}
private static SSAInstruction[] makeStatements(JavaTypeContext context) {
private static SSAInstruction[] makeStatements(Context context) {
ArrayList<SSAInstruction> statements = new ArrayList<>();
int nextLocal = 2;
int retValue = nextLocal++;
TypeReference tr = context.getType().getTypeReference();
SSAInstructionFactory insts = context.getType().getType().getClassLoader().getInstructionFactory();
TypeReference tr = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getTypeReference();
SSAInstructionFactory insts = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType().getClassLoader().getInstructionFactory();
if (tr != null) {
SSALoadMetadataInstruction l = insts.LoadMetadataInstruction(statements.size(), retValue, TypeReference.JavaLangClass, tr);
statements.add(l);
@ -126,7 +129,7 @@ public class GetClassContextInterpeter implements SSAContextInterpreter {
return result;
}
private static IR makeIR(IMethod method, JavaTypeContext context) {
private static IR makeIR(IMethod method, Context context) {
SSAInstruction instrs[] = makeStatements(context);
return new SyntheticIR(method, context, new InducedCFG(instrs, method, context), instrs, SSAOptions.defaultOptions(), null);
}

View File

@ -83,10 +83,17 @@ public class GetMethodContext implements Context {
this.name = name;
}
class NameItem implements ContextItem {
String name() { return getName(); }
};
@Override
public ContextItem get(ContextKey name) {
if (name == ContextKey.RECEIVER) {
return type;
} else if (name == ContextKey.NAME) {
return new NameItem();
} else if (name == ContextKey.PARAMETERS[0]) {
if (type instanceof PointType) {
IClass cls = ((PointType) type).getIClass();

View File

@ -15,6 +15,8 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import com.ibm.wala.analysis.reflection.GetMethodContext.NameItem;
import com.ibm.wala.analysis.typeInference.TypeAbstraction;
import com.ibm.wala.cfg.ControlFlowGraph;
import com.ibm.wala.cfg.InducedCFG;
import com.ibm.wala.classLoader.CallSiteReference;
@ -22,6 +24,8 @@ import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.classLoader.NewSiteReference;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextKey;
import com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter;
import com.ibm.wala.ipa.summaries.SyntheticIR;
import com.ibm.wala.ssa.ConstantValue;
@ -79,15 +83,15 @@ public class GetMethodContextInterpreter implements SSAContextInterpreter {
System.err.println("generating IR for " + node);
}
IMethod method = node.getMethod();
GetMethodContext context = (GetMethodContext) node.getContext();
Context context = node.getContext();
Map<Integer,ConstantValue> constants = HashMapFactory.make();
if (method.getReference().equals(GET_METHOD)) {
Atom name = Atom.findOrCreateAsciiAtom(context.getName());
Atom name = Atom.findOrCreateAsciiAtom(((NameItem)(context.get(ContextKey.NAME))).name());
SSAInstruction instrs[] = makeGetMethodStatements(context,constants,name);
return new SyntheticIR(method, context, new InducedCFG(instrs, method, context), instrs, SSAOptions.defaultOptions(), constants);
}
if (method.getReference().equals(GET_DECLARED_METHOD)) {
Atom name = Atom.findOrCreateAsciiAtom(context.getName());
Atom name = Atom.findOrCreateAsciiAtom(((NameItem)(context.get(ContextKey.NAME))).name());
SSAInstruction instrs[] = makeGetDeclaredMethodStatements(context,constants,name);
return new SyntheticIR(method, context, new InducedCFG(instrs, method, context), instrs, SSAOptions.defaultOptions(), constants);
}
@ -117,7 +121,7 @@ public class GetMethodContextInterpreter implements SSAContextInterpreter {
if (node == null) {
throw new IllegalArgumentException("node is null");
}
if (!(node.getContext() instanceof GetMethodContext)) {
if (!(node.getContext().isA(GetMethodContext.class))) {
return false;
}
MethodReference mRef = node.getMethod().getReference();
@ -190,13 +194,13 @@ public class GetMethodContextInterpreter implements SSAContextInterpreter {
(
MethodReference ref,
Collection<IMethod> returnValues,
GetMethodContext context,
Context context,
Map<Integer, ConstantValue> constants
) {
ArrayList<SSAInstruction> statements = new ArrayList<>();
int nextLocal = ref.getNumberOfParameters() + 2;
IClass cls = context.getType().getType();
SSAInstructionFactory insts = context.getType().getType().getClassLoader().getInstructionFactory();
IClass cls = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType();
SSAInstructionFactory insts = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType().getClassLoader().getInstructionFactory();
if (cls != null) {
for (IMethod m : returnValues) {
int c = nextLocal++;
@ -219,11 +223,11 @@ public class GetMethodContextInterpreter implements SSAContextInterpreter {
private static SSAInstruction[] makeGetMethodStatements
(
GetMethodContext context,
Context context,
Map<Integer,ConstantValue> constants,
Atom name
) {
IClass cls = context.getType().getType();
IClass cls = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType();
if (cls == null) {
return getParticularMethodStatements(GET_METHOD, null, context, constants);
} else {
@ -234,8 +238,8 @@ public class GetMethodContextInterpreter implements SSAContextInterpreter {
/**
* Create statements for {@link Class#getDeclaredMethod(String, Class...)}.
*/
private static SSAInstruction[] makeGetDeclaredMethodStatements(GetMethodContext context, Map<Integer, ConstantValue> constants,Atom name) {
IClass cls = context.getType().getType();
private static SSAInstruction[] makeGetDeclaredMethodStatements(Context context, Map<Integer, ConstantValue> constants,Atom name) {
IClass cls = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType();
if (cls == null) {
return getParticularMethodStatements(GET_DECLARED_METHOD, null, context, constants);
} else {

View File

@ -15,6 +15,7 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.Map;
import com.ibm.wala.analysis.typeInference.TypeAbstraction;
import com.ibm.wala.cfg.ControlFlowGraph;
import com.ibm.wala.cfg.InducedCFG;
import com.ibm.wala.classLoader.CallSiteReference;
@ -22,6 +23,8 @@ import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.classLoader.NewSiteReference;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextKey;
import com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter;
import com.ibm.wala.ipa.summaries.SyntheticIR;
import com.ibm.wala.ssa.ConstantValue;
@ -106,7 +109,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
}
/** BEGIN Custom change: caching */
final JavaTypeContext context = (JavaTypeContext) node.getContext();
final Context context = node.getContext();
final IMethod method = node.getMethod();
final String hashKey = method.toString() + "@" + context.toString();
@ -128,7 +131,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
return getIR(node);
}
private static IR makeIR(IMethod method, JavaTypeContext context) {
private static IR makeIR(IMethod method, Context context) {
Map<Integer, ConstantValue> constants = HashMapFactory.make();
if (method.getReference().equals(GET_CONSTRUCTOR)) {
SSAInstruction instrs[] = makeGetCtorStatements(context, constants);
@ -192,7 +195,7 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
if (node == null) {
throw new IllegalArgumentException("node is null");
}
if (!(node.getContext() instanceof JavaTypeContext)) {
if (!(node.getContext().isA(JavaTypeContext.class))) {
return false;
}
MethodReference mRef = node.getMethod().getReference();
@ -207,8 +210,8 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
throw new IllegalArgumentException("node is null");
}
assert understands(node);
JavaTypeContext context = (JavaTypeContext) node.getContext();
TypeReference tr = context.getType().getTypeReference();
Context context = node.getContext();
TypeReference tr = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getTypeReference();
if (tr != null) {
return new NonNullSingletonIterator<>(NewSiteReference.make(0, tr));
}
@ -280,13 +283,13 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
*
* @param returnValues the possible return values for this method.
*/
private static SSAInstruction[] getMethodArrayStatements(MethodReference ref, Collection<IMethod> returnValues, JavaTypeContext context,
private static SSAInstruction[] getMethodArrayStatements(MethodReference ref, Collection<IMethod> returnValues, Context context,
Map<Integer, ConstantValue> constants) {
ArrayList<SSAInstruction> statements = new ArrayList<>();
int nextLocal = ref.getNumberOfParameters() + 2;
int retValue = nextLocal++;
IClass cls = context.getType().getType();
SSAInstructionFactory insts = context.getType().getType().getClassLoader().getInstructionFactory();
IClass cls = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType();
SSAInstructionFactory insts = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType().getClassLoader().getInstructionFactory();
if (cls != null) {
TypeReference arrType = ref.getReturnType();
NewSiteReference site = new NewSiteReference(retValue, arrType);
@ -328,11 +331,11 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
* @param returnValues the possible return values for this method.
*/
private static SSAInstruction[] getParticularMethodStatements(MethodReference ref, Collection<IMethod> returnValues,
JavaTypeContext context, Map<Integer, ConstantValue> constants) {
Context context, Map<Integer, ConstantValue> constants) {
ArrayList<SSAInstruction> statements = new ArrayList<>();
int nextLocal = ref.getNumberOfParameters() + 2;
IClass cls = context.getType().getType();
SSAInstructionFactory insts = context.getType().getType().getClassLoader().getInstructionFactory();
IClass cls = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType();
SSAInstructionFactory insts = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType().getClassLoader().getInstructionFactory();
if (cls != null) {
for (IMethod m : returnValues) {
int c = nextLocal++;
@ -356,8 +359,8 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
/**
* create statements for getConstructor()
*/
private static SSAInstruction[] makeGetCtorStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
private static SSAInstruction[] makeGetCtorStatements(Context context, Map<Integer, ConstantValue> constants) {
IClass cls = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType();
if (cls == null) {
return getParticularMethodStatements(GET_CONSTRUCTOR, null, context, constants);
} else {
@ -366,8 +369,8 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
}
// TODO
private static SSAInstruction[] makeGetCtorsStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
private static SSAInstruction[] makeGetCtorsStatements(Context context, Map<Integer, ConstantValue> constants) {
IClass cls = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType();
if (cls == null) {
return getMethodArrayStatements(GET_DECLARED_CONSTRUCTORS, null, context, constants);
} else {
@ -375,8 +378,8 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
}
}
private static SSAInstruction[] makeGetMethodStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
private static SSAInstruction[] makeGetMethodStatements(Context context, Map<Integer, ConstantValue> constants) {
IClass cls = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType();
if (cls == null) {
return getParticularMethodStatements(GET_METHOD, null, context, constants);
} else {
@ -384,8 +387,8 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
}
}
private static SSAInstruction[] makeGetMethodsStatments(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
private static SSAInstruction[] makeGetMethodsStatments(Context context, Map<Integer, ConstantValue> constants) {
IClass cls = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType();
if (cls == null) {
return getMethodArrayStatements(GET_METHODS, null, context, constants);
} else {
@ -396,8 +399,8 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
/**
* create statements for getConstructor()
*/
private static SSAInstruction[] makeGetDeclCtorStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
private static SSAInstruction[] makeGetDeclCtorStatements(Context context, Map<Integer, ConstantValue> constants) {
IClass cls = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType();
if (cls == null) {
return getParticularMethodStatements(GET_DECLARED_CONSTRUCTOR, null, context, constants);
} else {
@ -405,8 +408,8 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
}
}
private static SSAInstruction[] makeGetDeclCtorsStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
private static SSAInstruction[] makeGetDeclCtorsStatements(Context context, Map<Integer, ConstantValue> constants) {
IClass cls = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType();
if (cls == null) {
return getMethodArrayStatements(GET_DECLARED_CONSTRUCTORS, null, context, constants);
} else {
@ -417,8 +420,8 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
/**
* create statements for getDeclaredMethod()
*/
private static SSAInstruction[] makeGetDeclaredMethodStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
private static SSAInstruction[] makeGetDeclaredMethodStatements(Context context, Map<Integer, ConstantValue> constants) {
IClass cls = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType();
if (cls == null) {
return getParticularMethodStatements(GET_DECLARED_METHOD, null, context, constants);
} else {
@ -429,8 +432,8 @@ public class JavaLangClassContextInterpreter implements SSAContextInterpreter {
/**
* create statements for getDeclaredMethod()
*/
private static SSAInstruction[] makeGetDeclaredMethodsStatements(JavaTypeContext context, Map<Integer, ConstantValue> constants) {
IClass cls = context.getType().getType();
private static SSAInstruction[] makeGetDeclaredMethodsStatements(Context context, Map<Integer, ConstantValue> constants) {
IClass cls = ((TypeAbstraction)context.get(ContextKey.RECEIVER)).getType();
if (cls == null) {
return getMethodArrayStatements(GET_DECLARED_METHODS, null, context, constants);
} else {

View File

@ -20,6 +20,8 @@ import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.classLoader.NewSiteReference;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextKey;
import com.ibm.wala.ipa.callgraph.propagation.ConstantKey;
import com.ibm.wala.ipa.callgraph.propagation.ReceiverInstanceContext;
import com.ibm.wala.ipa.callgraph.propagation.SSAContextInterpreter;
@ -69,8 +71,8 @@ public class ReflectiveInvocationInterpreter extends AbstractReflectionInterpret
if (DEBUG) {
System.err.println("generating IR for " + node);
}
ReceiverInstanceContext recv = (ReceiverInstanceContext) node.getContext();
ConstantKey c = (ConstantKey) recv.getReceiver();
Context recv = node.getContext();
ConstantKey c = (ConstantKey) recv.get(ContextKey.RECEIVER);
IMethod m = (IMethod) c.getValue();
/** BEGIN Custom change: caching */
final IMethod method = node.getMethod();
@ -109,11 +111,11 @@ public class ReflectiveInvocationInterpreter extends AbstractReflectionInterpret
if (node == null) {
throw new IllegalArgumentException("node is null");
}
if (!(node.getContext() instanceof ReceiverInstanceContext)) {
if (!(node.getContext().isA(ReceiverInstanceContext.class))) {
return false;
}
ReceiverInstanceContext r = (ReceiverInstanceContext) node.getContext();
if (!(r.getReceiver() instanceof ConstantKey)) {
Context r = node.getContext();
if (!(r.get(ContextKey.RECEIVER) instanceof ConstantKey)) {
return false;
}
return node.getMethod().getReference().equals(METHOD_INVOKE) || node.getMethod().getReference().equals(CTOR_NEW_INSTANCE);
@ -146,7 +148,7 @@ public class ReflectiveInvocationInterpreter extends AbstractReflectionInterpret
* @param method is something like Method.invoke or Construction.newInstance
* @param target is the method being called reflectively
*/
private IR makeIR(IMethod method, IMethod target, ReceiverInstanceContext context) {
private IR makeIR(IMethod method, IMethod target, Context recv) {
SSAInstructionFactory insts = method.getDeclaringClass().getClassLoader().getInstructionFactory();
SpecializedMethod m = new SpecializedMethod(method, method.getDeclaringClass(), method.isStatic(), false);
@ -225,7 +227,7 @@ public class ReflectiveInvocationInterpreter extends AbstractReflectionInterpret
SSAInstruction[] instrs = new SSAInstruction[m.allInstructions.size()];
m.allInstructions.<SSAInstruction> toArray(instrs);
return new SyntheticIR(method, context, new InducedCFG(instrs, method, context), instrs, SSAOptions.defaultOptions(), constants);
return new SyntheticIR(method, recv, new InducedCFG(instrs, method, recv), instrs, SSAOptions.defaultOptions(), constants);
}
@Override

View File

@ -55,6 +55,7 @@ import com.ibm.wala.util.collections.HashMapFactory;
import com.ibm.wala.util.collections.MapIterator;
import com.ibm.wala.util.intset.IntSet;
import com.ibm.wala.util.intset.IntSetUtil;
import com.ibm.wala.util.intset.MutableIntSet;
public class MethodHandles {
@ -270,7 +271,9 @@ public class MethodHandles {
@Override
public IntSet getRelevantParameters(CGNode caller, CallSiteReference site) {
return isFindStatic(site.getDeclaredTarget())? params: self;
MutableIntSet x = IntSetUtil.makeMutableCopy(base.getRelevantParameters(caller, site));
x.addAll(isFindStatic(site.getDeclaredTarget())? params: self);
return x;
}
}
@ -392,7 +395,7 @@ public class MethodHandles {
@Override
public boolean understands(CGNode node) {
return isFindStatic(node) && node.getContext() instanceof FindContext;
return isFindStatic(node) && node.getContext().isA(FindContext.class);
}
@Override
@ -401,7 +404,7 @@ public class MethodHandles {
MethodSummary code = new MethodSummary(node.getMethod().getReference());
SummarizedMethod m = new SummarizedMethod(node.getMethod().getReference(), code, node.getMethod().getDeclaringClass());
SSAInstructionFactory insts = node.getMethod().getDeclaringClass().getClassLoader().getLanguage().instructionFactory();
assert node.getContext() instanceof FindContext;
assert node.getContext().isA(FindContext.class);
@SuppressWarnings("unchecked")
IClass cls = node.getClassHierarchy().lookupClass(((HandlesItem<TypeReference>)node.getContext().get(CLASS_KEY)).item);
@ -427,7 +430,7 @@ public class MethodHandles {
@Override
public boolean understands(CGNode node) {
return (isInvoke(node) || isType(node)) && node.getContext() instanceof MethodContext;
return (isInvoke(node) || isType(node)) && node.getContext().isA(MethodContext.class);
}
@Override
@ -436,7 +439,7 @@ public class MethodHandles {
MethodSummary code = new MethodSummary(node.getMethod().getReference());
SummarizedMethod m = new SummarizedMethod(node.getMethod().getReference(), code, node.getMethod().getDeclaringClass());
SSAInstructionFactory insts = node.getMethod().getDeclaringClass().getClassLoader().getLanguage().instructionFactory();
assert node.getContext() instanceof MethodContext;
assert node.getContext().isA(MethodContext.class);
MethodReference ref = ((MethodContext)node.getContext()).method;
boolean isStatic = node.getClassHierarchy().resolveMethod(ref).isStatic();
boolean isVoid = ref.getReturnType().equals(TypeReference.Void);

View File

@ -74,6 +74,7 @@ public class AnalysisOptions {
ONE_FLOW_TO_CASTS_APPLICATION_GET_METHOD("one_flow_to_casts_application_get_method", 1, false, false, true),
MULTI_FLOW_TO_CASTS_APPLICATION_GET_METHOD("multi_flow_to_casts_application_get_method", 100, false, false, true),
NO_STRING_CONSTANTS("no_string_constants", Integer.MAX_VALUE, false, true, false),
STRING_ONLY("string_constants", 0, true, false, true),
NONE("none", 0, true, true, true);
private final String name;

View File

@ -18,9 +18,16 @@ package com.ibm.wala.ipa.callgraph;
* As another example, for CPA, there would be name for each parameter slot ("zero","one","two"), and the Context provides a mapping
* from this name to a set of types. eg. "one" -&gt; {java.lang.String, java.lang.Date}
*/
public interface Context {
public interface Context extends ContextItem {
/**
* @return the objects corresponding to a given name
*/
ContextItem get(ContextKey name);
/**
* @return whether this context has a specific type
*/
default boolean isA(Class<? extends Context> type) {
return type.isInstance(this);
}
}

View File

@ -21,6 +21,18 @@ public interface ContextKey {
public final static ContextKey CALLER = new ContextKey() {
};
/**
* A property of contexts that might be generally useful: the "target" method.
*/
public final static ContextKey TARGET = new ContextKey() {
};
/**
* A property of contexts that might be generally useful: the "name".
*/
public final static ContextKey NAME = new ContextKey() {
};
/**
* A property of contexts that might be generally useful: the "call site" method ... used for call-string context schemes.
*/

View File

@ -70,6 +70,9 @@ public class DelegatingContext implements Context {
return "DelegatingContext [A=" + A + ", B=" + B + "]";
}
@Override
public boolean isA(Class<? extends Context> type) {
return A.isA(type) || B.isA(type);
}
}

View File

@ -17,11 +17,14 @@ import java.util.Map;
import java.util.Set;
import com.ibm.wala.analysis.reflection.JavaTypeContext;
import com.ibm.wala.analysis.typeInference.TypeAbstraction;
import com.ibm.wala.classLoader.CallSiteReference;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.CallGraph;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextKey;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.ipa.callgraph.propagation.ReceiverInstanceContext;
import com.ibm.wala.ipa.cha.IClassHierarchy;
import com.ibm.wala.shrikeBT.IInvokeInstruction;
@ -369,10 +372,10 @@ public abstract class BasicCallGraph<T> extends AbstractNumberedGraph<CGNode> im
for(CGNode n : this) {
String nm = n.getMethod().getDeclaringClass().getName().toString() + "/" + n.getMethod().getName() + "/" + n.getContext().getClass().toString();
if (n.getContext() instanceof ReceiverInstanceContext) {
nm = nm + "/" + ((ReceiverInstanceContext)n.getContext()).getReceiver().getConcreteType().getName();
if (n.getContext().isA(ReceiverInstanceContext.class)) {
nm = nm + "/" + ((InstanceKey)n.getContext().get(ContextKey.RECEIVER)).getConcreteType().getName();
} else if (n.getContext() instanceof JavaTypeContext) {
nm = nm + "/" + ((JavaTypeContext)n.getContext()).getType().getTypeReference().getName();
nm = nm + "/" + ((TypeAbstraction)n.getContext().get(ContextKey.RECEIVER)).getTypeReference().getName();
}
do {

View File

@ -15,6 +15,7 @@ import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextSelector;
import com.ibm.wala.ipa.callgraph.DelegatingContext;
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
import com.ibm.wala.util.intset.IntSet;
@ -56,9 +57,14 @@ public class DelegatingContextSelector implements ContextSelector {
if (DEBUG) {
System.err.println(("Case A " + A.getClass() + " " + C));
}
Context CB = B.getCalleeTarget(caller, site, callee, receiver);
if (CB != null) {
return new DelegatingContext(C, CB);
} else {
return C;
}
}
}
Context C = B.getCalleeTarget(caller, site, callee, receiver);
if (DEBUG) {
System.err.println(("Case B " + B.getClass() + " " + C));

View File

@ -75,7 +75,8 @@ public class AllocationSiteInNodeFactory implements InstanceKeyFactory {
CGNode nodeToUse = node;
// disallow recursion in contexts.
if (node.getContext() instanceof ReceiverInstanceContext || node.getContext() instanceof CallerContext) {
if (node.getContext().isA(ReceiverInstanceContext.class) ||
node.getContext().isA(CallerContext.class)) {
IMethod m = node.getMethod();
CGNode n = ContainerContextSelector.findNodeRecursiveMatchingContext(m, node.getContext());
if (n != null) {

View File

@ -720,7 +720,7 @@ public abstract class PropagationCallGraphBuilder implements CallGraphBuilder<In
}
Context targetContext = contextSelector.getCalleeTarget(caller, site, targetMethod, iKey);
if (targetContext instanceof IllegalArgumentExceptionContext) {
if (targetContext.isA(IllegalArgumentExceptionContext.class)) {
return null;
}
try {

View File

@ -56,7 +56,7 @@ public class SmushedAllocationSiteInstanceKeys implements InstanceKeyFactory {
}
// disallow recursion in contexts.
if (node.getContext() instanceof ReceiverInstanceContext) {
if (node.getContext().isA(ReceiverInstanceContext.class)) {
IMethod m = node.getMethod();
CGNode n = ContainerContextSelector.findNodeRecursiveMatchingContext(m, node.getContext());
if (n != null) {

View File

@ -51,6 +51,8 @@ public class TargetMethodContextSelector implements ContextSelector {
public ContextItem get(ContextKey name) {
if (name.equals(ContextKey.PARAMETERS[0])) {
return new FilteredPointerKey.TargetMethodFilter(M);
} else if (name.equals(ContextKey.TARGET)) {
return M;
} else {
return null;
}
@ -68,7 +70,9 @@ public class TargetMethodContextSelector implements ContextSelector {
@Override
public boolean equals(Object o) {
return (o instanceof MethodDispatchContext) && ((MethodDispatchContext) o).getTargetMethod().equals(M);
return (o instanceof Context) &&
((Context)o).isA(MethodDispatchContext.class) &&
((Context)o).get(ContextKey.TARGET).equals(M);
}
}

View File

@ -26,7 +26,9 @@ public class CallStringContext implements Context {
@Override
public boolean equals(Object o) {
return (o instanceof CallStringContext) && ((CallStringContext) o).cs.equals(cs);
return (o instanceof Context) &&
((Context)o).isA(CallStringContext.class) &&
((Context)o).get(CallStringContextSelector.CALL_STRING).equals(cs);
}
@Override

View File

@ -30,6 +30,13 @@ public abstract class CallStringContextSelector implements ContextSelector {
}
};
public static final ContextKey BASE = new ContextKey() {
@Override
public String toString() {
return "BASE_KEY";
}
};
public static class CallStringContextPair implements Context {
private final CallString cs;
@ -42,8 +49,10 @@ public abstract class CallStringContextSelector implements ContextSelector {
@Override
public boolean equals(Object o) {
return (o instanceof CallStringContextPair) && ((CallStringContextPair) o).cs.equals(cs)
&& ((CallStringContextPair) o).base.equals(base);
return o instanceof Context &&
((Context)o).isA(CallStringContextPair.class) &&
((Context)o).get(CALL_STRING).equals(cs) &&
((Context)o).get(BASE).equals(base);
}
@Override
@ -60,6 +69,8 @@ public abstract class CallStringContextSelector implements ContextSelector {
public ContextItem get(ContextKey name) {
if (CALL_STRING.equals(name)) {
return cs;
} else if (BASE.equals(name)) {
return base;
} else {
return base.get(name);
}

View File

@ -15,6 +15,7 @@ import com.ibm.wala.classLoader.IClass;
import com.ibm.wala.classLoader.IMethod;
import com.ibm.wala.ipa.callgraph.CGNode;
import com.ibm.wala.ipa.callgraph.Context;
import com.ibm.wala.ipa.callgraph.ContextKey;
import com.ibm.wala.ipa.callgraph.ContextSelector;
import com.ibm.wala.ipa.callgraph.propagation.AllocationSiteInNode;
import com.ibm.wala.ipa.callgraph.propagation.ContainerUtil;
@ -232,21 +233,20 @@ public class ContainerContextSelector implements ContextSelector {
if (DEBUG) {
System.err.println("findNodeRecursiveMatchingContext " + m + " in context " + c);
}
if (c instanceof ReceiverInstanceContext) {
ReceiverInstanceContext ric = (ReceiverInstanceContext) c;
if (!(ric.getReceiver() instanceof AllocationSiteInNode)) {
if (c.isA(ReceiverInstanceContext.class)) {
InstanceKey receiver = (InstanceKey) c.get(ContextKey.RECEIVER);
if (!(receiver instanceof AllocationSiteInNode)) {
return null;
}
AllocationSiteInNode i = (AllocationSiteInNode) ric.getReceiver();
AllocationSiteInNode i = (AllocationSiteInNode) receiver;
CGNode n = i.getNode();
if (n.getMethod().equals(m)) {
return n;
} else {
return findNodeRecursiveMatchingContext(m, n.getContext());
}
} else if (c instanceof CallerContext) {
CallerContext cc = (CallerContext) c;
CGNode n = cc.getCaller();
} else if (c.isA(CallerContext.class)) {
CGNode n = (CGNode) c.get(ContextKey.CALLER);
if (n.getMethod().equals(m)) {
return n;
} else {
@ -320,7 +320,7 @@ public class ContainerContextSelector implements ContextSelector {
if (receiver instanceof AllocationSiteInNode) {
AllocationSiteInNode I = (AllocationSiteInNode) receiver;
CGNode N = I.getNode();
if (N.getContext() instanceof ReceiverInstanceContext) {
if (N.getContext().isA(ReceiverInstanceContext.class)) {
return true;
}
}

View File

@ -72,6 +72,13 @@ public class DefaultPointerKeyFactory implements PointerKeyFactory {
if (field == null) {
throw new IllegalArgumentException("field is null");
}
IField resolveAgain = I.getConcreteType().getField(field.getName(), field.getFieldTypeReference().getName());
if (resolveAgain != null) {
field = resolveAgain;
}
return new InstanceFieldKey(I, field);
}

View File

@ -114,7 +114,7 @@ public class SummarizedMethodWithNames extends SummarizedMethod {
@Override
public String[] getLocalNames(int index, int vn) {
if (DEBUG) { System.err.printf("IR.getLocalNames({}, {})", index, vn); }
if (this.localNames.containsKey(vn)) {
if (localNames != null && localNames.containsKey(vn)) {
return new String[] { this.localNames.get(vn).toString() };
} else {
return null;

View File

@ -757,11 +757,14 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
if (refNumber == null) {
Assertions.UNREACHABLE("Cannot lookup value: " + R);
}
// N.B: we currently ignore the index
String I = atts.getValue(A_INDEX);
if (I == null) {
Assertions.UNREACHABLE("Must specify index for aaload " + governingMethod);
}
Integer idxNumber = symbolTable.get(I);
if (idxNumber == null) {
Assertions.UNREACHABLE("Cannot lookup value: " + I);
}
String strType = atts.getValue(A_TYPE);
TypeReference type;
if (strType == null) {
@ -779,8 +782,7 @@ public class XMLMethodSummaryReader implements BytecodeConstants {
}
int defNum = nextLocal;
symbolTable.put(defVar, Integer.valueOf(nextLocal++));
SSAArrayLoadInstruction S = insts.ArrayLoadInstruction(governingMethod.getNumberOfStatements(), defNum, refNumber.intValue(), 0,
type);
SSAArrayLoadInstruction S = insts.ArrayLoadInstruction(governingMethod.getNumberOfStatements(), defNum, refNumber, idxNumber, type);
governingMethod.addStatement(S);
}

View File

@ -10,8 +10,13 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
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.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

View File

@ -101,7 +101,7 @@ public class APKCallGraphDriver {
return "timeout";
}
};
CG = DalvikCallGraphTestBase.makeAPKCallGraph(libs(), null, apk1.getAbsolutePath(), pm, ReflectionOptions.NONE);
CG = DalvikCallGraphTestBase.makeAPKCallGraph(null, Util.androidJavaLib(), apk1.getAbsolutePath(), pm, ReflectionOptions.NONE);
System.err.println("Analyzed " + apk1 + " in " + (System.currentTimeMillis() - time));
System.err.println(new SDG<>(CG.fst, CG.snd, DataDependenceOptions.NO_BASE_NO_HEAP_NO_EXCEPTIONS, ControlDependenceOptions.NONE));

View File

@ -108,6 +108,7 @@ public abstract class Invoke extends Instruction {
String clazzName, String methodName, String descriptor,
int[] args, Opcode opcode, DexIMethod method) {
super(instLoc, clazzName, methodName, descriptor, args, opcode, method);
assert descriptor.contains("(");
}
@Override

View File

@ -788,7 +788,6 @@ public class DexSSABuilder extends AbstractIntRegisterMachine {
Language lang = dexCFG.getMethod().getDeclaringClass().getClassLoader().getLanguage();
// TODO: check that the signature needed by findOrCreate can use the descriptor
MethodReference m = MethodReference.findOrCreate(lang, loader, instruction.clazzName, instruction.methodName, instruction.descriptor);

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8

View File

@ -9,8 +9,13 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
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.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error

View File

@ -10,6 +10,7 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8