Merge branch 'wala' into master
This commit is contained in:
commit
7477b1730b
|
@ -5,11 +5,15 @@
|
||||||
*.out
|
*.out
|
||||||
*/bin/*
|
*/bin/*
|
||||||
com.ibm.wala.core/dat/wala.properties
|
com.ibm.wala.core/dat/wala.properties
|
||||||
com.ibm.wala.cast.java.polyglot/lib/java_cup.jar
|
|
||||||
com.ibm.wala.cast.java.polyglot/lib/polyglot.jar
|
|
||||||
com.ibm.wala.cast.java.test.data/src/JLex/
|
com.ibm.wala.cast.java.test.data/src/JLex/
|
||||||
com.ibm.wala.cast.js.rhino/lib/
|
com.ibm.wala.cast.js.rhino/lib/
|
||||||
com.ibm.wala.cast.js/lib/
|
com.ibm.wala.cast.js/lib/
|
||||||
com.ibm.wala.cast.js.rhino.test/2009_swine_flu_outbreak
|
com.ibm.wala.cast.js.rhino.test/2009_swine_flu_outbreak
|
||||||
com.ibm.wala.cast.js.rhino.test/*.html
|
com.ibm.wala.cast.js.rhino.test/*.html
|
||||||
com.ibm.wala.cast.js.test/examples-src/ajaxslt/
|
com.ibm.wala.cast.js.test/examples-src/ajaxslt/
|
||||||
|
com.ibm.wala.cast.java.polyglot/lib/
|
||||||
|
.metadata/
|
||||||
|
com.ibm.wala.cast.js.test/examples-src/ajaxslt/
|
||||||
|
com.ibm.wala.core.testdata/@dot/
|
||||||
|
com.ibm.wala.core.testdata/lib/
|
||||||
|
com.ibm.wala.cast.js.html.nu_validator/lib/
|
||||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -128,10 +128,11 @@ import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
|
||||||
import org.eclipse.jdt.core.dom.WhileStatement;
|
import org.eclipse.jdt.core.dom.WhileStatement;
|
||||||
|
|
||||||
import com.ibm.wala.cast.ir.translator.AstTranslator.InternalCAstSymbol;
|
import com.ibm.wala.cast.ir.translator.AstTranslator.InternalCAstSymbol;
|
||||||
|
import com.ibm.wala.cast.ir.translator.TranslatorToCAst;
|
||||||
|
import com.ibm.wala.cast.ir.translator.TranslatorToCAst.DoLoopTranslator;
|
||||||
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl;
|
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl;
|
||||||
import com.ibm.wala.cast.java.loader.Util;
|
import com.ibm.wala.cast.java.loader.Util;
|
||||||
import com.ibm.wala.cast.java.translator.JavaProcedureEntity;
|
import com.ibm.wala.cast.java.translator.JavaProcedureEntity;
|
||||||
import com.ibm.wala.cast.java.translator.TranslatorToCAst;
|
|
||||||
import com.ibm.wala.cast.tree.CAst;
|
import com.ibm.wala.cast.tree.CAst;
|
||||||
import com.ibm.wala.cast.tree.CAstControlFlowMap;
|
import com.ibm.wala.cast.tree.CAstControlFlowMap;
|
||||||
import com.ibm.wala.cast.tree.CAstEntity;
|
import com.ibm.wala.cast.tree.CAstEntity;
|
||||||
|
@ -175,7 +176,7 @@ import com.ibm.wala.util.debug.Assertions;
|
||||||
// * enums (probably in simplename or something. but using resolveConstantExpressionValue() possible)
|
// * enums (probably in simplename or something. but using resolveConstantExpressionValue() possible)
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public class JDTJava2CAstTranslator implements TranslatorToCAst {
|
public class JDTJava2CAstTranslator {
|
||||||
protected final CAst fFactory = new CAstImpl();
|
protected final CAst fFactory = new CAstImpl();
|
||||||
|
|
||||||
// ///////////////////////////////////////////
|
// ///////////////////////////////////////////
|
||||||
|
@ -203,6 +204,8 @@ public class JDTJava2CAstTranslator implements TranslatorToCAst {
|
||||||
|
|
||||||
protected ITypeBinding OutOfMemoryError;
|
protected ITypeBinding OutOfMemoryError;
|
||||||
|
|
||||||
|
protected DoLoopTranslator doLoopTranslator;
|
||||||
|
|
||||||
private String fullPath;
|
private String fullPath;
|
||||||
|
|
||||||
private CompilationUnit cu;
|
private CompilationUnit cu;
|
||||||
|
@ -211,20 +214,7 @@ public class JDTJava2CAstTranslator implements TranslatorToCAst {
|
||||||
// COMPILATION UNITS & TYPES
|
// COMPILATION UNITS & TYPES
|
||||||
//
|
//
|
||||||
|
|
||||||
public JDTJava2CAstTranslator(JavaSourceLoaderImpl sourceLoader) {
|
public JDTJava2CAstTranslator(JavaSourceLoaderImpl sourceLoader, CompilationUnit astRoot, String fullPath, boolean replicateForDoLoops) {
|
||||||
this.fSourceLoader = sourceLoader;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CAstEntity translate(Object astRoot, String fullPath) {
|
|
||||||
this.cu = (CompilationUnit) astRoot;
|
|
||||||
|
|
||||||
this.fullPath = fullPath;
|
|
||||||
ast = cu.getAST();
|
|
||||||
|
|
||||||
// FIXME: we might need one AST (-> "Object" class) for all files.
|
|
||||||
fIdentityMapper = new JDTIdentityMapper(fSourceLoader.getReference(), ast);
|
|
||||||
fTypeDict = new JDTTypeDictionary(ast, fIdentityMapper);
|
|
||||||
|
|
||||||
fDivByZeroExcType = FakeExceptionTypeBinding.arithmetic;
|
fDivByZeroExcType = FakeExceptionTypeBinding.arithmetic;
|
||||||
fNullPointerExcType = FakeExceptionTypeBinding.nullPointer;
|
fNullPointerExcType = FakeExceptionTypeBinding.nullPointer;
|
||||||
fClassCastExcType = FakeExceptionTypeBinding.classCast;
|
fClassCastExcType = FakeExceptionTypeBinding.classCast;
|
||||||
|
@ -232,12 +222,27 @@ public class JDTJava2CAstTranslator implements TranslatorToCAst {
|
||||||
ExceptionInInitializerError = FakeExceptionTypeBinding.initException;
|
ExceptionInInitializerError = FakeExceptionTypeBinding.initException;
|
||||||
OutOfMemoryError = FakeExceptionTypeBinding.outOfMemory;
|
OutOfMemoryError = FakeExceptionTypeBinding.outOfMemory;
|
||||||
|
|
||||||
|
this.fSourceLoader = sourceLoader;
|
||||||
|
this.cu = astRoot;
|
||||||
|
|
||||||
|
this.fullPath = fullPath;
|
||||||
|
ast = cu.getAST();
|
||||||
|
|
||||||
|
this.doLoopTranslator = new DoLoopTranslator(replicateForDoLoops, fFactory);
|
||||||
|
|
||||||
|
// FIXME: we might need one AST (-> "Object" class) for all files.
|
||||||
|
fIdentityMapper = new JDTIdentityMapper(fSourceLoader.getReference(), ast);
|
||||||
|
fTypeDict = new JDTTypeDictionary(ast, fIdentityMapper);
|
||||||
|
|
||||||
fRuntimeExcType = ast.resolveWellKnownType("java.lang.RuntimeException");
|
fRuntimeExcType = ast.resolveWellKnownType("java.lang.RuntimeException");
|
||||||
assert fRuntimeExcType != null;
|
assert fRuntimeExcType != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CAstEntity translateToCAst() {
|
||||||
|
|
||||||
List<CAstEntity> declEntities = new ArrayList<CAstEntity>();
|
List<CAstEntity> declEntities = new ArrayList<CAstEntity>();
|
||||||
|
|
||||||
for (Iterator iter = cu.types().iterator(); iter.hasNext();) {
|
for (Iterator<CAstEntity> iter = cu.types().iterator(); iter.hasNext();) {
|
||||||
AbstractTypeDeclaration decl = (AbstractTypeDeclaration) iter.next();
|
AbstractTypeDeclaration decl = (AbstractTypeDeclaration) iter.next();
|
||||||
// can be of type AnnotationTypeDeclaration, EnumDeclaration, TypeDeclaration
|
// can be of type AnnotationTypeDeclaration, EnumDeclaration, TypeDeclaration
|
||||||
declEntities.add(visit(decl, new RootContext()));
|
declEntities.add(visit(decl, new RootContext()));
|
||||||
|
@ -2095,7 +2100,6 @@ public class JDTJava2CAstTranslator implements TranslatorToCAst {
|
||||||
// ////////////////
|
// ////////////////
|
||||||
|
|
||||||
private CAstNode visit(LabeledStatement n, WalkContext context) {
|
private CAstNode visit(LabeledStatement n, WalkContext context) {
|
||||||
ASTNode breakTarget = makeBreakOrContinueTarget(n, n.getLabel().getIdentifier());
|
|
||||||
|
|
||||||
// find the first non-block statement ant set-up the label map (useful for breaking many fors)
|
// find the first non-block statement ant set-up the label map (useful for breaking many fors)
|
||||||
ASTNode stmt = n.getBody();
|
ASTNode stmt = n.getBody();
|
||||||
|
@ -2108,10 +2112,12 @@ public class JDTJava2CAstTranslator implements TranslatorToCAst {
|
||||||
|
|
||||||
CAstNode result;
|
CAstNode result;
|
||||||
if (!(n.getBody() instanceof EmptyStatement)) {
|
if (!(n.getBody() instanceof EmptyStatement)) {
|
||||||
|
ASTNode breakTarget = makeBreakOrContinueTarget(n, n.getLabel().getIdentifier());
|
||||||
|
CAstNode breakNode = visitNode(breakTarget, context);
|
||||||
WalkContext child = new BreakContext(context, n.getLabel().getIdentifier(), breakTarget);
|
WalkContext child = new BreakContext(context, n.getLabel().getIdentifier(), breakTarget);
|
||||||
|
|
||||||
result = makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, makeNode(context, fFactory, n, CAstNode.LABEL_STMT, fFactory
|
result = makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, makeNode(context, fFactory, n, CAstNode.LABEL_STMT, fFactory
|
||||||
.makeConstant(n.getLabel().getIdentifier()), visitNode(n.getBody(), child)), visitNode(breakTarget, context));
|
.makeConstant(n.getLabel().getIdentifier()), visitNode(n.getBody(), child)), breakNode);
|
||||||
} else {
|
} else {
|
||||||
result = makeNode(context, fFactory, n, CAstNode.LABEL_STMT, fFactory.makeConstant(n.getLabel().getIdentifier()), visitNode(n
|
result = makeNode(context, fFactory, n, CAstNode.LABEL_STMT, fFactory.makeConstant(n.getLabel().getIdentifier()), visitNode(n
|
||||||
.getBody(), context));
|
.getBody(), context));
|
||||||
|
@ -2163,7 +2169,10 @@ public class JDTJava2CAstTranslator implements TranslatorToCAst {
|
||||||
Statement body = n.getBody();
|
Statement body = n.getBody();
|
||||||
|
|
||||||
ASTNode breakTarget = makeBreakOrContinueTarget(n, "breakLabel" + n.getStartPosition());
|
ASTNode breakTarget = makeBreakOrContinueTarget(n, "breakLabel" + n.getStartPosition());
|
||||||
|
CAstNode breakNode = visitNode(breakTarget, context);
|
||||||
|
|
||||||
ASTNode continueTarget = makeBreakOrContinueTarget(n, "continueLabel" + n.getStartPosition());
|
ASTNode continueTarget = makeBreakOrContinueTarget(n, "continueLabel" + n.getStartPosition());
|
||||||
|
CAstNode continueNode = visitNode(continueTarget, context);
|
||||||
|
|
||||||
String loopLabel = (String) context.getLabelMap().get(n);
|
String loopLabel = (String) context.getLabelMap().get(n);
|
||||||
LoopContext lc = new LoopContext(context, loopLabel, breakTarget, continueTarget);
|
LoopContext lc = new LoopContext(context, loopLabel, breakTarget, continueTarget);
|
||||||
|
@ -2172,8 +2181,8 @@ public class JDTJava2CAstTranslator implements TranslatorToCAst {
|
||||||
* The following loop is created sligtly differently than in jscore. It doesn't have a specific target for continue.
|
* The following loop is created sligtly differently than in jscore. It doesn't have a specific target for continue.
|
||||||
*/
|
*/
|
||||||
return makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, makeNode(context, fFactory, n, CAstNode.LOOP, visitNode(cond,
|
return makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, makeNode(context, fFactory, n, CAstNode.LOOP, visitNode(cond,
|
||||||
context), makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, visitNode(body, lc), visitNode(continueTarget, context))),
|
context), makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, visitNode(body, lc), continueNode)),
|
||||||
visitNode(breakTarget, context));
|
breakNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
private CAstNode getSwitchCaseConstant(SwitchCase n, WalkContext context) {
|
private CAstNode getSwitchCaseConstant(SwitchCase n, WalkContext context) {
|
||||||
|
@ -2282,22 +2291,21 @@ public class JDTJava2CAstTranslator implements TranslatorToCAst {
|
||||||
}
|
}
|
||||||
|
|
||||||
private CAstNode visit(DoStatement n, WalkContext context) {
|
private CAstNode visit(DoStatement n, WalkContext context) {
|
||||||
ASTNode header = ast.newEmptyStatement();
|
|
||||||
ASTNode breakTarget = makeBreakOrContinueTarget(n, "breakLabel" + n.getStartPosition());
|
|
||||||
ASTNode continueTarget = makeBreakOrContinueTarget(n, "continue" + "Label" + n.getStartPosition());
|
|
||||||
|
|
||||||
CAstNode loopGoto = makeNode(context, fFactory, n, CAstNode.IFGOTO, visitNode(n.getExpression(), context));
|
|
||||||
|
|
||||||
context.cfg().map(loopGoto, loopGoto);
|
|
||||||
context.cfg().add(loopGoto, header, Boolean.TRUE);
|
|
||||||
|
|
||||||
String loopLabel = (String) context.getLabelMap().get(n); // set by visit(LabeledStatement)
|
String loopLabel = (String) context.getLabelMap().get(n); // set by visit(LabeledStatement)
|
||||||
WalkContext loopContext = new LoopContext(context, loopLabel, breakTarget, continueTarget);
|
String token = loopLabel==null? "at_" + n.getStartPosition(): loopLabel;
|
||||||
|
|
||||||
|
ASTNode breakTarget = makeBreakOrContinueTarget(n, "breakLabel_" + token);
|
||||||
|
CAstNode breakNode = visitNode(breakTarget, context);
|
||||||
|
|
||||||
|
ASTNode continueTarget = makeBreakOrContinueTarget(n, "continueLabel_" + token);
|
||||||
CAstNode continueNode = visitNode(continueTarget, context);
|
CAstNode continueNode = visitNode(continueTarget, context);
|
||||||
|
|
||||||
|
CAstNode loopTest = visitNode(n.getExpression(), context);
|
||||||
|
|
||||||
return makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, visitNode(header, context), makeNode(context, fFactory, n,
|
WalkContext loopContext = new LoopContext(context, loopLabel, breakTarget, continueTarget);
|
||||||
CAstNode.BLOCK_STMT, visitNode(n.getBody(), loopContext), continueNode), loopGoto, visitNode(breakTarget, context));
|
CAstNode loopBody = visitNode(n.getBody(), loopContext);
|
||||||
|
|
||||||
|
return doLoopTranslator.translateDoLoop(loopTest, loopBody, continueNode, breakNode, context);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2889,24 +2897,12 @@ public class JDTJava2CAstTranslator implements TranslatorToCAst {
|
||||||
* Contains things needed by in the visit() of some nodes to process the nodes. For example, pos() contains the source position
|
* Contains things needed by in the visit() of some nodes to process the nodes. For example, pos() contains the source position
|
||||||
* mapping which each node registers
|
* mapping which each node registers
|
||||||
*/
|
*/
|
||||||
public static interface WalkContext {
|
public static interface WalkContext extends TranslatorToCAst.WalkContext<WalkContext, ASTNode> {
|
||||||
// LEFTOUT: plenty of stuff
|
|
||||||
public CAstControlFlowRecorder cfg();
|
|
||||||
|
|
||||||
public void addScopedEntity(CAstNode newNode, CAstEntity visit);
|
|
||||||
|
|
||||||
public Collection<Pair<ITypeBinding, Object>> getCatchTargets(ITypeBinding type);
|
public Collection<Pair<ITypeBinding, Object>> getCatchTargets(ITypeBinding type);
|
||||||
|
|
||||||
public CAstSourcePositionRecorder pos();
|
|
||||||
|
|
||||||
public CAstNodeTypeMapRecorder getNodeTypeMap();
|
|
||||||
|
|
||||||
public Map<ASTNode, String> getLabelMap();
|
public Map<ASTNode, String> getLabelMap();
|
||||||
|
|
||||||
public ASTNode getContinueFor(String label);
|
|
||||||
|
|
||||||
public ASTNode getBreakFor(String label);
|
|
||||||
|
|
||||||
public boolean needLValue();
|
public boolean needLValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2914,46 +2910,21 @@ public class JDTJava2CAstTranslator implements TranslatorToCAst {
|
||||||
* Default context functions. When one context doesn't handle something, it the next one up does. For example, there is only one
|
* Default context functions. When one context doesn't handle something, it the next one up does. For example, there is only one
|
||||||
* source pos. mapping per MethodContext, so loop contexts delegate it up.
|
* source pos. mapping per MethodContext, so loop contexts delegate it up.
|
||||||
*/
|
*/
|
||||||
public static class DelegatingContext implements WalkContext {
|
public static class DelegatingContext extends TranslatorToCAst.DelegatingContext<WalkContext, ASTNode> implements WalkContext {
|
||||||
protected WalkContext parent;
|
|
||||||
|
|
||||||
public DelegatingContext(WalkContext parent) {
|
public DelegatingContext(WalkContext parent) {
|
||||||
this.parent = parent;
|
super(parent);
|
||||||
}
|
|
||||||
|
|
||||||
public CAstControlFlowRecorder cfg() {
|
|
||||||
return parent.cfg();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CAstSourcePositionRecorder pos() {
|
|
||||||
return parent.pos();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CAstNodeTypeMapRecorder getNodeTypeMap() {
|
|
||||||
return parent.getNodeTypeMap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Pair<ITypeBinding, Object>> getCatchTargets(ITypeBinding type) {
|
public Collection<Pair<ITypeBinding, Object>> getCatchTargets(ITypeBinding type) {
|
||||||
return parent.getCatchTargets(type);
|
return parent.getCatchTargets(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addScopedEntity(CAstNode newNode, CAstEntity visit) {
|
|
||||||
parent.addScopedEntity(newNode, visit);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Map<ASTNode, String> getLabelMap() {
|
public Map<ASTNode, String> getLabelMap() {
|
||||||
return parent.getLabelMap();
|
return parent.getLabelMap();
|
||||||
}
|
}
|
||||||
|
|
||||||
public ASTNode getContinueFor(String label) {
|
public boolean needLValue() {
|
||||||
return parent.getContinueFor(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ASTNode getBreakFor(String label) {
|
|
||||||
return parent.getBreakFor(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean needLValue() {
|
|
||||||
return parent.needLValue();
|
return parent.needLValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2961,27 +2932,8 @@ public class JDTJava2CAstTranslator implements TranslatorToCAst {
|
||||||
/*
|
/*
|
||||||
* Root context. Doesn't do anything.
|
* Root context. Doesn't do anything.
|
||||||
*/
|
*/
|
||||||
public static class RootContext implements WalkContext {
|
public static class RootContext extends TranslatorToCAst.RootContext<WalkContext, ASTNode> implements WalkContext {
|
||||||
public void addScopedEntity(CAstNode newNode, CAstEntity visit) {
|
public Collection<Pair<ITypeBinding, Object>> getCatchTargets(ITypeBinding type) {
|
||||||
Assertions.UNREACHABLE("Rootcontext.addScopedEntity()");
|
|
||||||
}
|
|
||||||
|
|
||||||
public CAstControlFlowRecorder cfg() {
|
|
||||||
Assertions.UNREACHABLE("RootContext.cfg()");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CAstSourcePositionRecorder pos() {
|
|
||||||
Assertions.UNREACHABLE("RootContext.pos()");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CAstNodeTypeMapRecorder getNodeTypeMap() {
|
|
||||||
Assertions.UNREACHABLE("RootContext.getNodeTypeMap()");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<Pair<ITypeBinding, Object>> getCatchTargets(ITypeBinding type) {
|
|
||||||
Assertions.UNREACHABLE("RootContext.getCatchTargets()");
|
Assertions.UNREACHABLE("RootContext.getCatchTargets()");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -2991,16 +2943,6 @@ public class JDTJava2CAstTranslator implements TranslatorToCAst {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ASTNode getBreakFor(String label) {
|
|
||||||
Assertions.UNREACHABLE("RootContext.getBreakFor()");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ASTNode getContinueFor(String label) {
|
|
||||||
Assertions.UNREACHABLE("RootContext.getContinueFor()");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean needLValue() {
|
public boolean needLValue() {
|
||||||
Assertions.UNREACHABLE("Rootcontext.needLValue()");
|
Assertions.UNREACHABLE("Rootcontext.needLValue()");
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -115,8 +115,6 @@ public class JDTSourceModuleTranslator implements SourceModuleTranslator {
|
||||||
public void loadAllSources(Set<ModuleEntry> modules) {
|
public void loadAllSources(Set<ModuleEntry> modules) {
|
||||||
// TODO: we might need one AST (-> "Object" class) for all files.
|
// TODO: we might need one AST (-> "Object" class) for all files.
|
||||||
// TODO: group by project and send 'em in
|
// TODO: group by project and send 'em in
|
||||||
JDTJava2CAstTranslator jdt2cast = makeCAstTranslator();
|
|
||||||
final Java2IRTranslator java2ir = makeIRTranslator(jdt2cast);
|
|
||||||
|
|
||||||
System.out.println(modules);
|
System.out.println(modules);
|
||||||
|
|
||||||
|
@ -143,7 +141,9 @@ public class JDTSourceModuleTranslator implements SourceModuleTranslator {
|
||||||
public void acceptAST(ICompilationUnit source, CompilationUnit ast) {
|
public void acceptAST(ICompilationUnit source, CompilationUnit ast) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
java2ir.translate(proj.getValue().get(source), ast, source.getUnderlyingResource().getLocation().toOSString());
|
JDTJava2CAstTranslator jdt2cast = makeCAstTranslator(ast, source.getUnderlyingResource().getLocation().toOSString());
|
||||||
|
final Java2IRTranslator java2ir = makeIRTranslator();
|
||||||
|
java2ir.translate(proj.getValue().get(source), jdt2cast.translateToCAst());
|
||||||
} catch (JavaModelException e) {
|
} catch (JavaModelException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -165,12 +165,12 @@ public class JDTSourceModuleTranslator implements SourceModuleTranslator {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Java2IRTranslator makeIRTranslator(JDTJava2CAstTranslator jdt2cast) {
|
protected Java2IRTranslator makeIRTranslator() {
|
||||||
return new Java2IRTranslator(jdt2cast, sourceLoader);
|
return new Java2IRTranslator(sourceLoader);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected JDTJava2CAstTranslator makeCAstTranslator() {
|
protected JDTJava2CAstTranslator makeCAstTranslator(CompilationUnit cu, String fullPath) {
|
||||||
return new JDTJava2CAstTranslator(sourceLoader);
|
return new JDTJava2CAstTranslator(sourceLoader, cu, fullPath, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
|
<launchConfiguration type="org.eclipse.jdt.junit.launchconfig">
|
||||||
<stringAttribute key="bad_container_name" value="/com.ibm.wala.cast.java.polyglottest/launchers"/>
|
<stringAttribute key="bad_container_name" value="/com.ibm.wala.cast.java.polyglottest/launchers"/>
|
||||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||||
|
@ -11,7 +11,9 @@
|
||||||
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
|
||||||
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
|
||||||
|
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.launching.macosx.MacOSXType/java 1.6"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.cast.java.test.PolyglotJavaIRTests"/>
|
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.ibm.wala.cast.java.test.PolyglotJavaIRTests"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.cast.java.polyglot.test"/>
|
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="com.ibm.wala.cast.java.polyglot.test"/>
|
||||||
|
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-ea -Xmx512M"/>
|
||||||
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:com.ibm.wala.cast.java.test.data}"/>
|
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:com.ibm.wala.cast.java.test.data}"/>
|
||||||
</launchConfiguration>
|
</launchConfiguration>
|
||||||
|
|
|
@ -51,16 +51,18 @@ public class IRGoal extends SourceGoal_c /* PORT1.7 removed 'implements EndGoal'
|
||||||
ExtensionInfo extInfo= job.extensionInfo();
|
ExtensionInfo extInfo= job.extensionInfo();
|
||||||
|
|
||||||
fTranslator= new Java2IRTranslator(
|
fTranslator= new Java2IRTranslator(
|
||||||
|
fSourceLoader,
|
||||||
|
((IRTranslatorExtension)extInfo).getCAstRewriterFactory());
|
||||||
|
ModuleSource src = (ModuleSource) job.source();
|
||||||
|
fTranslator.translate(
|
||||||
|
src.getModule(),
|
||||||
new PolyglotJava2CAstTranslator(
|
new PolyglotJava2CAstTranslator(
|
||||||
|
job.ast(),
|
||||||
fSourceLoader.getReference(),
|
fSourceLoader.getReference(),
|
||||||
extInfo.nodeFactory(),
|
extInfo.nodeFactory(),
|
||||||
extInfo.typeSystem(),
|
extInfo.typeSystem(),
|
||||||
new PolyglotIdentityMapper(fSourceLoader.getReference()),
|
new PolyglotIdentityMapper(fSourceLoader.getReference()),
|
||||||
((IRTranslatorExtension)extInfo).getReplicateForDoLoops()),
|
((IRTranslatorExtension)extInfo).getReplicateForDoLoops()).translateToCAst());
|
||||||
fSourceLoader,
|
|
||||||
((IRTranslatorExtension)extInfo).getCAstRewriterFactory());
|
|
||||||
ModuleSource src = (ModuleSource) job.source();
|
|
||||||
fTranslator.translate(src.getModule(),job.ast(), src.name());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,7 @@ import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.LinkedHashSet;
|
import java.util.LinkedHashSet;
|
||||||
|
@ -34,6 +35,7 @@ import polyglot.ast.ArrayTypeNode;
|
||||||
import polyglot.ast.Assert;
|
import polyglot.ast.Assert;
|
||||||
import polyglot.ast.Assign;
|
import polyglot.ast.Assign;
|
||||||
import polyglot.ast.Binary;
|
import polyglot.ast.Binary;
|
||||||
|
import polyglot.ast.Binary.Operator;
|
||||||
import polyglot.ast.Block;
|
import polyglot.ast.Block;
|
||||||
import polyglot.ast.BooleanLit;
|
import polyglot.ast.BooleanLit;
|
||||||
import polyglot.ast.Branch;
|
import polyglot.ast.Branch;
|
||||||
|
@ -49,6 +51,7 @@ import polyglot.ast.ClassLit;
|
||||||
import polyglot.ast.ClassMember;
|
import polyglot.ast.ClassMember;
|
||||||
import polyglot.ast.Conditional;
|
import polyglot.ast.Conditional;
|
||||||
import polyglot.ast.ConstructorCall;
|
import polyglot.ast.ConstructorCall;
|
||||||
|
import polyglot.ast.ConstructorCall.Kind;
|
||||||
import polyglot.ast.ConstructorDecl;
|
import polyglot.ast.ConstructorDecl;
|
||||||
import polyglot.ast.Do;
|
import polyglot.ast.Do;
|
||||||
import polyglot.ast.Empty;
|
import polyglot.ast.Empty;
|
||||||
|
@ -94,8 +97,6 @@ import polyglot.ast.TopLevelDecl;
|
||||||
import polyglot.ast.Try;
|
import polyglot.ast.Try;
|
||||||
import polyglot.ast.Unary;
|
import polyglot.ast.Unary;
|
||||||
import polyglot.ast.While;
|
import polyglot.ast.While;
|
||||||
import polyglot.ast.Binary.Operator;
|
|
||||||
import polyglot.ast.ConstructorCall.Kind;
|
|
||||||
import polyglot.types.ArrayType;
|
import polyglot.types.ArrayType;
|
||||||
import polyglot.types.ClassType;
|
import polyglot.types.ClassType;
|
||||||
import polyglot.types.CodeInstance;
|
import polyglot.types.CodeInstance;
|
||||||
|
@ -117,9 +118,11 @@ import polyglot.types.Types;
|
||||||
import polyglot.util.Position;
|
import polyglot.util.Position;
|
||||||
|
|
||||||
import com.ibm.wala.cast.ir.translator.AstTranslator.InternalCAstSymbol;
|
import com.ibm.wala.cast.ir.translator.AstTranslator.InternalCAstSymbol;
|
||||||
|
import com.ibm.wala.cast.ir.translator.TranslatorToCAst;
|
||||||
|
import com.ibm.wala.cast.ir.translator.TranslatorToCAst.DoLoopTranslator;
|
||||||
|
import com.ibm.wala.cast.ir.translator.TranslatorToCAst.WalkContext;
|
||||||
import com.ibm.wala.cast.java.loader.Util;
|
import com.ibm.wala.cast.java.loader.Util;
|
||||||
import com.ibm.wala.cast.java.translator.JavaProcedureEntity;
|
import com.ibm.wala.cast.java.translator.JavaProcedureEntity;
|
||||||
import com.ibm.wala.cast.java.translator.TranslatorToCAst;
|
|
||||||
import com.ibm.wala.cast.java.types.JavaType;
|
import com.ibm.wala.cast.java.types.JavaType;
|
||||||
import com.ibm.wala.cast.tree.CAst;
|
import com.ibm.wala.cast.tree.CAst;
|
||||||
import com.ibm.wala.cast.tree.CAstControlFlowMap;
|
import com.ibm.wala.cast.tree.CAstControlFlowMap;
|
||||||
|
@ -132,12 +135,10 @@ import com.ibm.wala.cast.tree.CAstSymbol;
|
||||||
import com.ibm.wala.cast.tree.CAstType;
|
import com.ibm.wala.cast.tree.CAstType;
|
||||||
import com.ibm.wala.cast.tree.CAstTypeDictionary;
|
import com.ibm.wala.cast.tree.CAstTypeDictionary;
|
||||||
import com.ibm.wala.cast.tree.impl.AbstractSourcePosition;
|
import com.ibm.wala.cast.tree.impl.AbstractSourcePosition;
|
||||||
import com.ibm.wala.cast.tree.impl.CAstCloner;
|
|
||||||
import com.ibm.wala.cast.tree.impl.CAstControlFlowRecorder;
|
import com.ibm.wala.cast.tree.impl.CAstControlFlowRecorder;
|
||||||
import com.ibm.wala.cast.tree.impl.CAstImpl;
|
import com.ibm.wala.cast.tree.impl.CAstImpl;
|
||||||
import com.ibm.wala.cast.tree.impl.CAstNodeTypeMapRecorder;
|
import com.ibm.wala.cast.tree.impl.CAstNodeTypeMapRecorder;
|
||||||
import com.ibm.wala.cast.tree.impl.CAstOperator;
|
import com.ibm.wala.cast.tree.impl.CAstOperator;
|
||||||
import com.ibm.wala.cast.tree.impl.CAstRewriter;
|
|
||||||
import com.ibm.wala.cast.tree.impl.CAstSourcePositionRecorder;
|
import com.ibm.wala.cast.tree.impl.CAstSourcePositionRecorder;
|
||||||
import com.ibm.wala.cast.tree.impl.CAstSymbolImpl;
|
import com.ibm.wala.cast.tree.impl.CAstSymbolImpl;
|
||||||
import com.ibm.wala.classLoader.CallSiteReference;
|
import com.ibm.wala.classLoader.CallSiteReference;
|
||||||
|
@ -155,8 +156,7 @@ import com.ibm.wala.util.collections.IteratorPlusOne;
|
||||||
import com.ibm.wala.util.collections.Pair;
|
import com.ibm.wala.util.collections.Pair;
|
||||||
import com.ibm.wala.util.debug.Assertions;
|
import com.ibm.wala.util.debug.Assertions;
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
public class PolyglotJava2CAstTranslator {
|
||||||
public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
|
||||||
protected final CAst fFactory = new CAstImpl();
|
protected final CAst fFactory = new CAstImpl();
|
||||||
|
|
||||||
protected final NodeFactory fNodeFactory;
|
protected final NodeFactory fNodeFactory;
|
||||||
|
@ -179,10 +179,12 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
|
|
||||||
protected PolyglotIdentityMapper fIdentityMapper;
|
protected PolyglotIdentityMapper fIdentityMapper;
|
||||||
|
|
||||||
protected boolean replicateForDoLoops = false;
|
protected final DoLoopTranslator doLoopTranslator;
|
||||||
|
|
||||||
protected final boolean DEBUG = true;
|
protected final boolean DEBUG = true;
|
||||||
|
|
||||||
|
private final Node ast;
|
||||||
|
|
||||||
final protected TranslatingVisitor getTranslator() {
|
final protected TranslatingVisitor getTranslator() {
|
||||||
if (fTranslator == null)
|
if (fTranslator == null)
|
||||||
fTranslator = createTranslator();
|
fTranslator = createTranslator();
|
||||||
|
@ -1133,42 +1135,17 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
String loopLabel = (String) wc.getLabelMap().get(d);
|
String loopLabel = (String) wc.getLabelMap().get(d);
|
||||||
|
|
||||||
CAstNode continueNode = walkNodes(continueTarget, wc);
|
CAstNode continueNode = walkNodes(continueTarget, wc);
|
||||||
CAstNode breakBody = walkNodes(breakTarget, wc);
|
CAstNode breakNode = walkNodes(breakTarget, wc);
|
||||||
|
|
||||||
WalkContext lc = new LoopContext(wc, loopLabel, breakTarget, continueTarget);
|
|
||||||
CAstNode loopBody = walkNodes(d.body(), lc);
|
|
||||||
|
|
||||||
if (replicateForDoLoops) {
|
WalkContext lc = new LoopContext(wc, loopLabel, breakTarget, continueTarget);
|
||||||
CAstRewriter.Rewrite x = (new CAstCloner(fFactory, false)).copy(loopBody, wc.cfg(), wc.pos(), wc.getNodeTypeMap(), null);
|
CAstNode loopExpr = walkNodes(d.cond(), wc);
|
||||||
CAstNode otherBody = x.newRoot();
|
CAstNode loopBody = walkNodes(d.body(), lc);
|
||||||
|
|
||||||
wc.cfg().addAll(x.newCfg());
|
|
||||||
wc.pos().addAll(x.newPos());
|
|
||||||
wc.getNodeTypeMap().addAll(x.newTypes());
|
|
||||||
|
|
||||||
return makeNode(wc, fFactory, d, CAstNode.BLOCK_STMT,
|
return doLoopTranslator.translateDoLoop(loopExpr, loopBody, continueNode, breakNode, wc);
|
||||||
loopBody,
|
|
||||||
makeNode(wc, fFactory, d, CAstNode.LOOP,
|
|
||||||
walkNodes(d.cond(), wc),
|
|
||||||
makeNode(wc, fFactory, d, CAstNode.BLOCK_STMT, otherBody, continueNode)),
|
|
||||||
breakBody);
|
|
||||||
|
|
||||||
} else {
|
|
||||||
Node header = fNodeFactory.Empty(Position.COMPILER_GENERATED);
|
|
||||||
|
|
||||||
CAstNode loopGoto = makeNode(wc, fFactory, d, CAstNode.IFGOTO, walkNodes(d.cond(), wc));
|
|
||||||
|
|
||||||
wc.cfg().map(loopGoto, loopGoto);
|
|
||||||
wc.cfg().add(loopGoto, header, Boolean.TRUE);
|
|
||||||
|
|
||||||
return makeNode(wc, fFactory, d, CAstNode.BLOCK_STMT,
|
|
||||||
walkNodes(header, wc),
|
|
||||||
makeNode(wc, fFactory, d, CAstNode.BLOCK_STMT, loopBody, continueNode),
|
|
||||||
loopGoto,
|
|
||||||
breakBody);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public CAstNode visit(For f, WalkContext wc) {
|
public CAstNode visit(For f, WalkContext wc) {
|
||||||
Node breakTarget = makeBreakTarget(f);
|
Node breakTarget = makeBreakTarget(f);
|
||||||
Node continueTarget = makeContinueTarget(f);
|
Node continueTarget = makeContinueTarget(f);
|
||||||
|
@ -1529,12 +1506,8 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
protected abstract static class CodeBodyEntity implements CAstEntity {
|
protected abstract static class CodeBodyEntity implements CAstEntity {
|
||||||
private final Map<CAstNode, Collection<CAstEntity>> fEntities;
|
private final Map<CAstNode, Collection<CAstEntity>> fEntities;
|
||||||
|
|
||||||
public CodeBodyEntity(Map<CAstNode, CAstEntity> entities) {
|
public CodeBodyEntity(Map<CAstNode, Collection<CAstEntity>> entities) {
|
||||||
fEntities = new LinkedHashMap<CAstNode, Collection<CAstEntity>>();
|
fEntities = new LinkedHashMap<CAstNode, Collection<CAstEntity>>(entities);
|
||||||
for (Iterator<CAstNode> keys = entities.keySet().iterator(); keys.hasNext();) {
|
|
||||||
CAstNode key = keys.next();
|
|
||||||
fEntities.put(key, Collections.singleton(entities.get(key)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<CAstNode, Collection<CAstEntity>> getAllScopedEntities() {
|
public Map<CAstNode, Collection<CAstEntity>> getAllScopedEntities() {
|
||||||
|
@ -1674,7 +1647,7 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
private final String[] argumentNames;
|
private final String[] argumentNames;
|
||||||
|
|
||||||
public ProcedureEntity(CAstNode pdast, TypeSystem system, CodeInstance pd, Type declaringType, String[] argumentNames,
|
public ProcedureEntity(CAstNode pdast, TypeSystem system, CodeInstance pd, Type declaringType, String[] argumentNames,
|
||||||
Map<CAstNode, CAstEntity> entities, MethodContext mc) {
|
Map<CAstNode, Collection<CAstEntity>> entities, MethodContext mc) {
|
||||||
super(entities);
|
super(entities);
|
||||||
fPdast = pdast;
|
fPdast = pdast;
|
||||||
fSystem = system;
|
fSystem = system;
|
||||||
|
@ -1685,7 +1658,7 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProcedureEntity(CAstNode pdast, TypeSystem system, CodeInstance pd, String[] argumentNames,
|
public ProcedureEntity(CAstNode pdast, TypeSystem system, CodeInstance pd, String[] argumentNames,
|
||||||
Map<CAstNode, CAstEntity> entities, MethodContext mc) {
|
Map<CAstNode, Collection<CAstEntity>> entities, MethodContext mc) {
|
||||||
//PORT1.7 used to be this(pdast, system, pd, ((MemberInstance) pd).container(), argumentNames, entities, mc);
|
//PORT1.7 used to be this(pdast, system, pd, ((MemberInstance) pd).container(), argumentNames, entities, mc);
|
||||||
this(pdast, system, pd, ((MemberDef) pd.def()).container().get(), argumentNames, entities, mc);
|
this(pdast, system, pd, ((MemberDef) pd.def()).container().get(), argumentNames, entities, mc);
|
||||||
}
|
}
|
||||||
|
@ -1916,21 +1889,9 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface WalkContext {
|
public interface WalkContext extends TranslatorToCAst.WalkContext<WalkContext, Node> {
|
||||||
void addScopedEntity(CAstNode node, CAstEntity e);
|
|
||||||
|
|
||||||
CAstControlFlowRecorder cfg();
|
|
||||||
|
|
||||||
CAstSourcePositionRecorder pos();
|
|
||||||
|
|
||||||
CAstNodeTypeMapRecorder getNodeTypeMap();
|
|
||||||
|
|
||||||
Collection<Pair<Type, Object>> getCatchTargets(Type label);
|
Collection<Pair<Type, Object>> getCatchTargets(Type label);
|
||||||
|
|
||||||
Node getContinueFor(String label);
|
|
||||||
|
|
||||||
Node getBreakFor(String label);
|
|
||||||
|
|
||||||
Node getFinally();
|
Node getFinally();
|
||||||
|
|
||||||
CodeInstance getEnclosingMethod();
|
CodeInstance getEnclosingMethod();
|
||||||
|
@ -1948,49 +1909,15 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
boolean needLVal();
|
boolean needLVal();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static class DelegatingContext implements WalkContext {
|
protected static class DelegatingContext extends TranslatorToCAst.DelegatingContext<WalkContext, Node> implements WalkContext {
|
||||||
private final WalkContext parent;
|
|
||||||
|
|
||||||
public WalkContext getParent() {
|
|
||||||
return parent;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected DelegatingContext(WalkContext parent) {
|
protected DelegatingContext(WalkContext parent) {
|
||||||
this.parent = parent;
|
super(parent);
|
||||||
}
|
|
||||||
|
|
||||||
public void addScopedEntity(CAstNode node, CAstEntity e) {
|
|
||||||
parent.addScopedEntity(node, e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// public Map/*<CAstNode,CAstEntity>*/ getScopedEntities() {
|
|
||||||
// return parent.getScopedEntities();
|
|
||||||
// }
|
|
||||||
|
|
||||||
public CAstControlFlowRecorder cfg() {
|
|
||||||
return parent.cfg();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CAstSourcePositionRecorder pos() {
|
|
||||||
return parent.pos();
|
|
||||||
}
|
|
||||||
|
|
||||||
public CAstNodeTypeMapRecorder getNodeTypeMap() {
|
|
||||||
return parent.getNodeTypeMap();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Collection<Pair<Type, Object>> getCatchTargets(Type label) {
|
public Collection<Pair<Type, Object>> getCatchTargets(Type label) {
|
||||||
return parent.getCatchTargets(label);
|
return parent.getCatchTargets(label);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Node getContinueFor(String label) {
|
|
||||||
return parent.getContinueFor(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Node getBreakFor(String label) {
|
|
||||||
return parent.getBreakFor(label);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Node getFinally() {
|
public Node getFinally() {
|
||||||
return parent.getFinally();
|
return parent.getFinally();
|
||||||
}
|
}
|
||||||
|
@ -2121,9 +2048,9 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
|
|
||||||
private final Map<Node, String> labelMap = HashMapFactory.make(2);
|
private final Map<Node, String> labelMap = HashMapFactory.make(2);
|
||||||
|
|
||||||
private final Map<CAstNode, CAstEntity> fEntities;
|
private final Map<CAstNode, Collection<CAstEntity>> fEntities;
|
||||||
|
|
||||||
public CodeBodyContext(WalkContext parent, Map<CAstNode, CAstEntity> entities) {
|
public CodeBodyContext(WalkContext parent, Map<CAstNode, Collection<CAstEntity>> entities) {
|
||||||
super(parent);
|
super(parent);
|
||||||
fEntities = entities;
|
fEntities = entities;
|
||||||
}
|
}
|
||||||
|
@ -2141,10 +2068,11 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addScopedEntity(CAstNode node, CAstEntity entity) {
|
public void addScopedEntity(CAstNode node, CAstEntity entity) {
|
||||||
fEntities.put(node, entity);
|
if (! fEntities.containsKey(node)) { fEntities.put(node, new HashSet<CAstEntity>(1)); }
|
||||||
|
fEntities.get(node).add(entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map/* <CAstNode,CAstEntity> */<CAstNode, CAstEntity> getScopedEntities() {
|
public Map<CAstNode, Collection<CAstEntity>> getScopedEntities() {
|
||||||
return fEntities;
|
return fEntities;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2160,7 +2088,7 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
public class MethodContext extends CodeBodyContext {
|
public class MethodContext extends CodeBodyContext {
|
||||||
final CodeInstance fPI;
|
final CodeInstance fPI;
|
||||||
|
|
||||||
public MethodContext(CodeInstance pi, Map<CAstNode, CAstEntity> entities, WalkContext parent) {
|
public MethodContext(CodeInstance pi, Map<CAstNode, Collection<CAstEntity>> entities, WalkContext parent) {
|
||||||
super(parent, entities);
|
super(parent, entities);
|
||||||
fPI = pi;
|
fPI = pi;
|
||||||
}
|
}
|
||||||
|
@ -2188,8 +2116,8 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
this.tryNode = tryNode;
|
this.tryNode = tryNode;
|
||||||
this.context = context;
|
this.context = context;
|
||||||
|
|
||||||
for (Iterator catchIter = tryNode.catchBlocks().iterator(); catchIter.hasNext();) {
|
for (Iterator<Catch> catchIter = tryNode.catchBlocks().iterator(); catchIter.hasNext();) {
|
||||||
Catch c = (Catch) catchIter.next();
|
Catch c = catchIter.next();
|
||||||
Pair<Type,Object> p = Pair.make(c.catchType(), (Object)c);
|
Pair<Type,Object> p = Pair.make(c.catchType(), (Object)c);
|
||||||
|
|
||||||
fCatchNodes.add(p);
|
fCatchNodes.add(p);
|
||||||
|
@ -2217,7 +2145,7 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catchNodes.addAll(getParent().getCatchTargets(label));
|
catchNodes.addAll(parent.getCatchTargets(label));
|
||||||
return catchNodes;
|
return catchNodes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2230,53 +2158,23 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static class RootContext implements WalkContext {
|
protected static class RootContext extends TranslatorToCAst.RootContext<WalkContext, Node> implements WalkContext {
|
||||||
final CAstTypeDictionary fTypeDict;
|
final CAstTypeDictionary fTypeDict;
|
||||||
|
|
||||||
public RootContext(CAstTypeDictionary typeDict) {
|
public RootContext(CAstTypeDictionary typeDict) {
|
||||||
fTypeDict = typeDict;
|
fTypeDict = typeDict;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addScopedEntity(CAstNode node, CAstEntity e) {
|
|
||||||
Assertions.UNREACHABLE("Attempt to call addScopedEntity() on a RootContext.");
|
|
||||||
}
|
|
||||||
|
|
||||||
public CAstControlFlowRecorder cfg() {
|
|
||||||
Assertions.UNREACHABLE("RootContext.cfg()");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Collection<Pair<Type, Object>> getCatchTargets(Type label) {
|
public Collection<Pair<Type, Object>> getCatchTargets(Type label) {
|
||||||
Assertions.UNREACHABLE("RootContext.getCatchTargets()");
|
Assertions.UNREACHABLE("RootContext.getCatchTargets()");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CAstNodeTypeMapRecorder getNodeTypeMap() {
|
|
||||||
Assertions.UNREACHABLE("RootContext.getNodeTypeMap()");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Node getFinally() {
|
public Node getFinally() {
|
||||||
Assertions.UNREACHABLE("RootContext.getFinally()");
|
Assertions.UNREACHABLE("RootContext.getFinally()");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CAstSourcePositionRecorder pos() {
|
|
||||||
// No AST, so no AST map
|
|
||||||
Assertions.UNREACHABLE("RootContext.pos()");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Node getContinueFor(String label) {
|
|
||||||
Assertions.UNREACHABLE("RootContext.getContinueFor()");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Node getBreakFor(String label) {
|
|
||||||
Assertions.UNREACHABLE("RootContext.getBreakFor()");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CodeInstance getEnclosingMethod() {
|
public CodeInstance getEnclosingMethod() {
|
||||||
Assertions.UNREACHABLE("RootContext.getEnclosingMethod()");
|
Assertions.UNREACHABLE("RootContext.getEnclosingMethod()");
|
||||||
return null;
|
return null;
|
||||||
|
@ -2360,12 +2258,13 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PolyglotJava2CAstTranslator(ClassLoaderReference clr, NodeFactory nf, TypeSystem ts, PolyglotIdentityMapper identityMapper, boolean replicateForDoLoops) {
|
public PolyglotJava2CAstTranslator(Node ast, ClassLoaderReference clr, NodeFactory nf, TypeSystem ts, PolyglotIdentityMapper identityMapper, boolean replicateForDoLoops) {
|
||||||
|
this.ast = ast;
|
||||||
fClassLoaderRef = clr;
|
fClassLoaderRef = clr;
|
||||||
fTypeSystem = ts;
|
fTypeSystem = ts;
|
||||||
fNodeFactory = nf;
|
fNodeFactory = nf;
|
||||||
fIdentityMapper = identityMapper;
|
fIdentityMapper = identityMapper;
|
||||||
this.replicateForDoLoops = replicateForDoLoops;
|
doLoopTranslator = new DoLoopTranslator(replicateForDoLoops, fFactory);
|
||||||
fNPEType = fTypeSystem.NullPointerException();
|
fNPEType = fTypeSystem.NullPointerException();
|
||||||
fCCEType = fTypeSystem.ClassCastException();
|
fCCEType = fTypeSystem.ClassCastException();
|
||||||
fREType = fTypeSystem.RuntimeException();
|
fREType = fTypeSystem.RuntimeException();
|
||||||
|
@ -2530,8 +2429,8 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
return cn;
|
return cn;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CAstEntity translate(Object ast, String fileName) {
|
public CAstEntity translateToCAst() {
|
||||||
return walkEntity((Node) ast, new RootContext(getTypeDict()));
|
return walkEntity(ast, new RootContext(getTypeDict()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2623,7 +2522,7 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
InitializerDef initDef = fTypeSystem.initializerDef(n.position(), Types.ref(classType), Flags.STATIC);
|
InitializerDef initDef = fTypeSystem.initializerDef(n.position(), Types.ref(classType), Flags.STATIC);
|
||||||
InitializerInstance initInstance = fTypeSystem.createInitializerInstance(n.position(), Types.ref(initDef));
|
InitializerInstance initInstance = fTypeSystem.createInitializerInstance(n.position(), Types.ref(initDef));
|
||||||
|
|
||||||
Map<CAstNode, CAstEntity> childEntities = HashMapFactory.make();
|
Map<CAstNode, Collection<CAstEntity>> childEntities = HashMapFactory.make();
|
||||||
final MethodContext mc = new MethodContext(initInstance, childEntities, classContext);
|
final MethodContext mc = new MethodContext(initInstance, childEntities, classContext);
|
||||||
|
|
||||||
List inits = classContext.getStaticInitializers();
|
List inits = classContext.getStaticInitializers();
|
||||||
|
@ -2644,7 +2543,7 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
for (Iterator iter = superConstructors.iterator(); iter.hasNext();) {
|
for (Iterator iter = superConstructors.iterator(); iter.hasNext();) {
|
||||||
ConstructorInstance superCtor = (ConstructorInstance) iter.next();
|
ConstructorInstance superCtor = (ConstructorInstance) iter.next();
|
||||||
|
|
||||||
Map<CAstNode, CAstEntity> childEntities = HashMapFactory.make();
|
Map<CAstNode, Collection<CAstEntity>> childEntities = HashMapFactory.make();
|
||||||
final MethodContext mc = new MethodContext(superCtor, childEntities, classContext);
|
final MethodContext mc = new MethodContext(superCtor, childEntities, classContext);
|
||||||
|
|
||||||
String[] fakeArguments = new String[superCtor.formalTypes().size() + 1];
|
String[] fakeArguments = new String[superCtor.formalTypes().size() + 1];
|
||||||
|
@ -2713,7 +2612,7 @@ public class PolyglotJava2CAstTranslator implements TranslatorToCAst {
|
||||||
return new ClassEntity(classContext, memberEntities, anonType, anonTypeName, n.position());
|
return new ClassEntity(classContext, memberEntities, anonType, anonTypeName, n.position());
|
||||||
} else if (rootNode instanceof ProcedureDecl) {
|
} else if (rootNode instanceof ProcedureDecl) {
|
||||||
final ProcedureDecl pd = (ProcedureDecl) rootNode;
|
final ProcedureDecl pd = (ProcedureDecl) rootNode;
|
||||||
final Map<CAstNode, CAstEntity> memberEntities = new LinkedHashMap<CAstNode, CAstEntity>();
|
final Map<CAstNode, Collection<CAstEntity>> memberEntities = HashMapFactory.make();
|
||||||
final MethodContext mc = new MethodContext(pd.procedureInstance().asInstance(), memberEntities, context);
|
final MethodContext mc = new MethodContext(pd.procedureInstance().asInstance(), memberEntities, context);
|
||||||
|
|
||||||
CAstNode pdAST = null;
|
CAstNode pdAST = null;
|
||||||
|
|
|
@ -27,6 +27,7 @@ import java.util.jar.JarFile;
|
||||||
|
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
|
|
||||||
|
import com.ibm.wala.cast.ir.translator.AstTranslator;
|
||||||
import com.ibm.wala.cast.java.client.JavaSourceAnalysisEngine;
|
import com.ibm.wala.cast.java.client.JavaSourceAnalysisEngine;
|
||||||
import com.ibm.wala.cast.java.ipa.callgraph.JavaSourceAnalysisScope;
|
import com.ibm.wala.cast.java.ipa.callgraph.JavaSourceAnalysisScope;
|
||||||
import com.ibm.wala.classLoader.IClass;
|
import com.ibm.wala.classLoader.IClass;
|
||||||
|
@ -282,6 +283,9 @@ public abstract class IRTests {
|
||||||
public Pair runTest(Collection<String> sources, List<String> libs, String[] mainClassDescriptors, List<? extends IRAssertion> ca,
|
public Pair runTest(Collection<String> sources, List<String> libs, String[] mainClassDescriptors, List<? extends IRAssertion> ca,
|
||||||
boolean assertReachable) {
|
boolean assertReachable) {
|
||||||
try {
|
try {
|
||||||
|
boolean currentState = AstTranslator.NEW_LEXICAL;
|
||||||
|
AstTranslator.NEW_LEXICAL = false;
|
||||||
|
|
||||||
JavaSourceAnalysisEngine engine = getAnalysisEngine(mainClassDescriptors);
|
JavaSourceAnalysisEngine engine = getAnalysisEngine(mainClassDescriptors);
|
||||||
|
|
||||||
populateScope(engine, sources, libs);
|
populateScope(engine, sources, libs);
|
||||||
|
@ -297,6 +301,8 @@ public abstract class IRTests {
|
||||||
IRAssertion.check(callGraph);
|
IRAssertion.check(callGraph);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AstTranslator.NEW_LEXICAL = currentState;
|
||||||
|
|
||||||
return Pair.make(callGraph, engine.getPointerAnalysis());
|
return Pair.make(callGraph, engine.getPointerAnalysis());
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
|
|
@ -138,7 +138,7 @@ public abstract class JavaIRTests extends IRTests {
|
||||||
final IClass iClass = cg.getClassHierarchy().lookupClass(type);
|
final IClass iClass = cg.getClassHierarchy().lookupClass(type);
|
||||||
Assert.assertNotNull("Could not find class " + typeStr, iClass);
|
Assert.assertNotNull("Could not find class " + typeStr, iClass);
|
||||||
|
|
||||||
final Collection<IClass> interfaces = iClass.getDirectInterfaces();
|
final Collection<? extends IClass> interfaces = iClass.getDirectInterfaces();
|
||||||
|
|
||||||
Assert.assertEquals("Expected one single interface.", interfaces.size(), 1);
|
Assert.assertEquals("Expected one single interface.", interfaces.size(), 1);
|
||||||
|
|
||||||
|
|
|
@ -186,7 +186,7 @@ public class SynchronizedBlockDuplicator extends
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected CAstNode copyNodes(CAstNode n, RewriteContext<UnwindKey> c, Map<Pair<CAstNode, UnwindKey>, CAstNode> nodeMap) {
|
protected CAstNode copyNodes(CAstNode n, final CAstControlFlowMap cfg, RewriteContext<UnwindKey> c, Map<Pair<CAstNode, UnwindKey>, CAstNode> nodeMap) {
|
||||||
String varName;
|
String varName;
|
||||||
// don't copy operators or constants (presumably since they are immutable?)
|
// don't copy operators or constants (presumably since they are immutable?)
|
||||||
if (n instanceof CAstOperator) {
|
if (n instanceof CAstOperator) {
|
||||||
|
@ -204,15 +204,15 @@ public class SynchronizedBlockDuplicator extends
|
||||||
Ast.makeNode(CAstNode.VAR, Ast.makeConstant(varName)));
|
Ast.makeNode(CAstNode.VAR, Ast.makeConstant(varName)));
|
||||||
|
|
||||||
// the new if conditional
|
// the new if conditional
|
||||||
return Ast.makeNode(CAstNode.IF_STMT, test, copyNodes(n, new SyncContext(true, n, c), nodeMap),
|
return Ast.makeNode(CAstNode.IF_STMT, test, copyNodes(n, cfg, new SyncContext(true, n, c), nodeMap),
|
||||||
copyNodes(n, new SyncContext(false, n, c), nodeMap));
|
copyNodes(n, cfg, new SyncContext(false, n, c), nodeMap));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// invoke copyNodes() on the children with context c, ensuring, e.g., that
|
// invoke copyNodes() on the children with context c, ensuring, e.g., that
|
||||||
// the body of a synchronized block gets cloned
|
// the body of a synchronized block gets cloned
|
||||||
CAstNode[] newChildren = new CAstNode[n.getChildCount()];
|
CAstNode[] newChildren = new CAstNode[n.getChildCount()];
|
||||||
for (int i = 0; i < newChildren.length; i++)
|
for (int i = 0; i < newChildren.length; i++)
|
||||||
newChildren[i] = copyNodes(n.getChild(i), c, nodeMap);
|
newChildren[i] = copyNodes(n.getChild(i), cfg, c, nodeMap);
|
||||||
|
|
||||||
CAstNode newN = Ast.makeNode(n.getKind(), newChildren);
|
CAstNode newN = Ast.makeNode(n.getKind(), newChildren);
|
||||||
|
|
||||||
|
|
|
@ -272,7 +272,7 @@ public class AstJavaSSAPropagationCallGraphBuilder extends AstSSAPropagationCall
|
||||||
}
|
}
|
||||||
|
|
||||||
public void visitJavaInvoke(AstJavaInvokeInstruction instruction) {
|
public void visitJavaInvoke(AstJavaInvokeInstruction instruction) {
|
||||||
visitInvokeInternal(instruction);
|
visitInvokeInternal(instruction, new DefaultInvariantComputer());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ package com.ibm.wala.cast.java.translator;
|
||||||
|
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
|
|
||||||
|
import com.ibm.wala.cast.ir.translator.TranslatorToCAst;
|
||||||
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl;
|
import com.ibm.wala.cast.java.loader.JavaSourceLoaderImpl;
|
||||||
import com.ibm.wala.cast.tree.CAst;
|
import com.ibm.wala.cast.tree.CAst;
|
||||||
import com.ibm.wala.cast.tree.CAstEntity;
|
import com.ibm.wala.cast.tree.CAstEntity;
|
||||||
|
@ -29,34 +30,29 @@ public class Java2IRTranslator {
|
||||||
|
|
||||||
protected final JavaSourceLoaderImpl fLoader;
|
protected final JavaSourceLoaderImpl fLoader;
|
||||||
|
|
||||||
protected final TranslatorToCAst fSourceTranslator;
|
|
||||||
|
|
||||||
CAstRewriterFactory castRewriterFactory = null;
|
CAstRewriterFactory castRewriterFactory = null;
|
||||||
|
|
||||||
public Java2IRTranslator(TranslatorToCAst sourceTranslator, JavaSourceLoaderImpl srcLoader) {
|
public Java2IRTranslator(JavaSourceLoaderImpl srcLoader) {
|
||||||
this(sourceTranslator, srcLoader, false);
|
this(srcLoader, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Java2IRTranslator(TranslatorToCAst sourceTranslator, JavaSourceLoaderImpl srcLoader, boolean debug) {
|
public Java2IRTranslator(JavaSourceLoaderImpl srcLoader, boolean debug) {
|
||||||
this(sourceTranslator, srcLoader, null, debug);
|
this(srcLoader, null, debug);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Java2IRTranslator(TranslatorToCAst sourceTranslator, JavaSourceLoaderImpl srcLoader,
|
public Java2IRTranslator(JavaSourceLoaderImpl srcLoader,
|
||||||
CAstRewriterFactory castRewriterFactory) {
|
CAstRewriterFactory castRewriterFactory) {
|
||||||
this(sourceTranslator, srcLoader, castRewriterFactory, false);
|
this(srcLoader, castRewriterFactory, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Java2IRTranslator(TranslatorToCAst sourceTranslator, JavaSourceLoaderImpl srcLoader,
|
public Java2IRTranslator(JavaSourceLoaderImpl srcLoader,
|
||||||
CAstRewriterFactory castRewriterFactory, boolean debug) {
|
CAstRewriterFactory castRewriterFactory, boolean debug) {
|
||||||
DEBUG = debug;
|
DEBUG = debug;
|
||||||
fLoader = srcLoader;
|
fLoader = srcLoader;
|
||||||
fSourceTranslator = sourceTranslator;
|
|
||||||
this.castRewriterFactory = castRewriterFactory;
|
this.castRewriterFactory = castRewriterFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void translate(ModuleEntry module, Object ast, String N) {
|
public void translate(ModuleEntry module, CAstEntity ce) {
|
||||||
CAstEntity ce = fSourceTranslator.translate(ast, N);
|
|
||||||
|
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
PrintWriter printWriter = new PrintWriter(System.out);
|
PrintWriter printWriter = new PrintWriter(System.out);
|
||||||
CAstPrinter.printTo(ce, printWriter);
|
CAstPrinter.printTo(ce, printWriter);
|
||||||
|
|
|
@ -304,27 +304,24 @@ public class JavaCAst2IRTranslator extends AstTranslator {
|
||||||
return ((JavaSourceLoaderImpl) loader).defineType(type, type.getType().getName(), parentType) != null;
|
return ((JavaSourceLoaderImpl) loader).defineType(type, type.getType().getName(), parentType) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void leaveThis(CAstNode n, Context c, CAstVisitor visitor) {
|
protected void leaveThis(CAstNode n, WalkContext c, CAstVisitor<WalkContext> visitor) {
|
||||||
if (n.getChildCount() == 0) {
|
if (n.getChildCount() == 0) {
|
||||||
super.leaveThis(n, c, visitor);
|
super.leaveThis(n, c, visitor);
|
||||||
} else {
|
} else {
|
||||||
WalkContext wc = (WalkContext) c;
|
int result = c.currentScope().allocateTempValue();
|
||||||
int result = wc.currentScope().allocateTempValue();
|
c.setValue(n, result);
|
||||||
setValue(n, result);
|
c.cfg().addInstruction(new EnclosingObjectReference(c.cfg().getCurrentInstruction(), result, (TypeReference) n.getChild(0).getValue()));
|
||||||
wc.cfg().addInstruction(new EnclosingObjectReference(wc.cfg().getCurrentInstruction(), result, (TypeReference) n.getChild(0).getValue()));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean visitCast(CAstNode n, Context c, CAstVisitor visitor) {
|
protected boolean visitCast(CAstNode n, WalkContext context, CAstVisitor<WalkContext> visitor) {
|
||||||
WalkContext context = (WalkContext) c;
|
|
||||||
int result = context.currentScope().allocateTempValue();
|
int result = context.currentScope().allocateTempValue();
|
||||||
setValue(n, result);
|
context.setValue(n, result);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void leaveCast(CAstNode n, Context c, CAstVisitor visitor) {
|
protected void leaveCast(CAstNode n, WalkContext context, CAstVisitor<WalkContext> visitor) {
|
||||||
WalkContext context = (WalkContext) c;
|
int result = context.getValue(n);
|
||||||
int result = getValue(n);
|
|
||||||
CAstType toType = (CAstType) n.getChild(0).getValue();
|
CAstType toType = (CAstType) n.getChild(0).getValue();
|
||||||
TypeReference toRef = makeType(toType);
|
TypeReference toRef = makeType(toType);
|
||||||
|
|
||||||
|
@ -332,48 +329,63 @@ public class JavaCAst2IRTranslator extends AstTranslator {
|
||||||
TypeReference fromRef = makeType(fromType);
|
TypeReference fromRef = makeType(fromType);
|
||||||
|
|
||||||
if (toRef.isPrimitiveType()) {
|
if (toRef.isPrimitiveType()) {
|
||||||
context.cfg().addInstruction(insts.ConversionInstruction(context.cfg().getCurrentInstruction(), result, getValue(n.getChild(1)), fromRef, toRef, false));
|
context.cfg().addInstruction(
|
||||||
|
insts.ConversionInstruction(
|
||||||
|
context.cfg().getCurrentInstruction(),
|
||||||
|
result,
|
||||||
|
context.getValue(n.getChild(1)),
|
||||||
|
fromRef,
|
||||||
|
toRef,
|
||||||
|
false));
|
||||||
} else {
|
} else {
|
||||||
context.cfg().addInstruction(insts.CheckCastInstruction(context.cfg().getCurrentInstruction(), result, getValue(n.getChild(1)), toRef));
|
context.cfg().addInstruction(
|
||||||
|
insts.CheckCastInstruction(
|
||||||
|
context.cfg().getCurrentInstruction(),
|
||||||
|
result,
|
||||||
|
context.getValue(n.getChild(1)),
|
||||||
|
toRef,
|
||||||
|
true));
|
||||||
|
|
||||||
processExceptions(n, context);
|
processExceptions(n, context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean visitInstanceOf(CAstNode n, Context c, CAstVisitor visitor) {
|
protected boolean visitInstanceOf(CAstNode n, WalkContext context, CAstVisitor<WalkContext> visitor) {
|
||||||
WalkContext context = (WalkContext) c;
|
|
||||||
int result = context.currentScope().allocateTempValue();
|
int result = context.currentScope().allocateTempValue();
|
||||||
setValue(n, result);
|
context.setValue(n, result);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void leaveInstanceOf(CAstNode n, Context c, CAstVisitor visitor) {
|
protected void leaveInstanceOf(CAstNode n, WalkContext context, CAstVisitor<WalkContext> visitor) {
|
||||||
WalkContext context = (WalkContext) c;
|
int result = context.getValue(n);
|
||||||
int result = getValue(n);
|
|
||||||
CAstType type = (CAstType) n.getChild(0).getValue();
|
CAstType type = (CAstType) n.getChild(0).getValue();
|
||||||
|
|
||||||
TypeReference ref = makeType(type);
|
TypeReference ref = makeType( type );
|
||||||
context.cfg().addInstruction(insts.InstanceofInstruction(context.cfg().getCurrentInstruction(), result, getValue(n.getChild(1)), ref));
|
context.cfg().addInstruction(
|
||||||
|
insts.InstanceofInstruction(
|
||||||
|
context.cfg().getCurrentInstruction(),
|
||||||
|
result,
|
||||||
|
context.getValue(n.getChild(1)),
|
||||||
|
ref));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean doVisit(CAstNode n, Context context, CAstVisitor visitor) {
|
protected boolean doVisit(CAstNode n, WalkContext wc, CAstVisitor<WalkContext> visitor) {
|
||||||
WalkContext wc = (WalkContext) context;
|
|
||||||
if (n.getKind() == CAstNode.MONITOR_ENTER) {
|
if (n.getKind() == CAstNode.MONITOR_ENTER) {
|
||||||
visitor.visit(n.getChild(0), wc, visitor);
|
visitor.visit(n.getChild(0), wc, visitor);
|
||||||
wc.cfg().addInstruction(insts.MonitorInstruction(wc.cfg().getCurrentInstruction(), getValue(n.getChild(0)), true));
|
wc.cfg().addInstruction(insts.MonitorInstruction(wc.cfg().getCurrentInstruction(), wc.getValue(n.getChild(0)), true));
|
||||||
processExceptions(n, wc);
|
processExceptions(n, wc);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else if (n.getKind() == CAstNode.MONITOR_EXIT) {
|
} else if (n.getKind() == CAstNode.MONITOR_EXIT) {
|
||||||
visitor.visit(n.getChild(0), wc, visitor);
|
visitor.visit(n.getChild(0), wc, visitor);
|
||||||
wc.cfg().addInstruction(insts.MonitorInstruction(wc.cfg().getCurrentInstruction(), getValue(n.getChild(0)), false));
|
wc.cfg().addInstruction(insts.MonitorInstruction(wc.cfg().getCurrentInstruction(), wc.getValue(n.getChild(0)), false));
|
||||||
processExceptions(n, wc);
|
processExceptions(n, wc);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return super.doVisit(n, wc, visitor);
|
return super.doVisit(n, wc, visitor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<classpath>
|
||||||
|
<classpathentry kind="src" path="src"/>
|
||||||
|
<classpathentry kind="src" path="tests"/>
|
||||||
|
<classpathentry kind="lib" path="lib/htmlparser-1.3.1.jar"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
|
||||||
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
</classpath>
|
|
@ -0,0 +1,28 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>com.ibm.wala.cast.js.html.nu_validator</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.jdt.core.javabuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ManifestBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.SchemaBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.pde.PluginNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,12 @@
|
||||||
|
#Thu Jan 05 09:28:01 MST 2012
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
|
org.eclipse.jdt.core.compiler.compliance=1.6
|
||||||
|
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.6
|
|
@ -0,0 +1,12 @@
|
||||||
|
Manifest-Version: 1.0
|
||||||
|
Bundle-ManifestVersion: 2
|
||||||
|
Bundle-Name: Nu_validator
|
||||||
|
Bundle-SymbolicName: com.ibm.wala.cast.js.html.nu_validator
|
||||||
|
Bundle-Version: 1.0.0.qualifier
|
||||||
|
Export-Package: com.ibm.wala.cast.js.html.nu_validator
|
||||||
|
Require-Bundle: com.ibm.wala.cast.js;bundle-version="1.0.0",
|
||||||
|
com.ibm.wala.cast.js.rhino.test;bundle-version="1.0.0",
|
||||||
|
com.ibm.wala.cast.js.test;bundle-version="1.0.0",
|
||||||
|
com.ibm.wala.cast.test;bundle-version="1.0.0",
|
||||||
|
com.ibm.wala.core.tests;bundle-version="1.1.3",
|
||||||
|
com.ibm.wala.core;bundle-version="1.1.3"
|
|
@ -0,0 +1,3 @@
|
||||||
|
source.. = src/
|
||||||
|
bin.includes = META-INF/,\
|
||||||
|
.
|
|
@ -0,0 +1,67 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project name="com.ibm.wala.cast.java.polyglot" default="getJars" basedir=".">
|
||||||
|
|
||||||
|
<property name="basews" value="${ws}"/>
|
||||||
|
<property name="baseos" value="${os}"/>
|
||||||
|
<property name="basearch" value="${arch}"/>
|
||||||
|
<property name="basenl" value="${nl}"/>
|
||||||
|
|
||||||
|
<!-- Compiler settings. -->
|
||||||
|
<property name="javacFailOnError" value="true"/>
|
||||||
|
<property name="javacDebugInfo" value="on"/>
|
||||||
|
<property name="javacVerbose" value="false"/>
|
||||||
|
<property name="logExtension" value=".log"/>
|
||||||
|
<property name="compilerArg" value=""/>
|
||||||
|
<property name="javacSource" value="1.5"/>
|
||||||
|
<property name="javacTarget" value="1.5"/>
|
||||||
|
<!-- This property has been updated to correspond to the paths used by the latest Java update
|
||||||
|
on Mac OS X 10.6 (Java version 1.6.0_22). If you are not using this version of Mac OS X or Java,
|
||||||
|
try changing the value of the property to "${java.home}/../../../Classes" -->
|
||||||
|
<condition property="dir_bootclasspath" value="${java.home}/../Classes">
|
||||||
|
<os family="mac"/>
|
||||||
|
</condition>
|
||||||
|
<property name="dir_bootclasspath" value="${java.home}/lib"/>
|
||||||
|
<path id="path_bootclasspath">
|
||||||
|
<fileset dir="${dir_bootclasspath}">
|
||||||
|
|
||||||
|
<include name="*.jar"/>
|
||||||
|
</fileset>
|
||||||
|
</path>
|
||||||
|
<property name="bootclasspath" refid="path_bootclasspath"/>
|
||||||
|
<property name="bundleJavacSource" value="${javacSource}"/>
|
||||||
|
<property name="bundleJavacTarget" value="${javacTarget}"/>
|
||||||
|
<property name="bundleBootClasspath" value="${bootclasspath}"/>
|
||||||
|
|
||||||
|
<target name="NuPresent" depends="init">
|
||||||
|
<available file="${plugin.destination}/lib/htmlparser-1.3.1.jar" property="nu.present"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="fetchNu" depends="NuPresent" unless="nu.present">
|
||||||
|
<delete dir="${temp.folder}"/>
|
||||||
|
<mkdir dir="${temp.folder}"/>
|
||||||
|
<get src="http://about.validator.nu/htmlparser/htmlparser-1.3.1.zip" dest="${temp.folder}/htmlparser-1.3.1.zip"/>
|
||||||
|
<unzip src="${temp.folder}/htmlparser-1.3.1.zip" dest="${temp.folder}"/>
|
||||||
|
<copy file="${temp.folder}/htmlparser-1.3.1/htmlparser-1.3.1.jar" tofile="${plugin.destination}/lib/htmlparser-1.3.1.jar" />
|
||||||
|
<delete dir="${temp.folder}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="getJars" depends="fetchNu" />
|
||||||
|
|
||||||
|
<target name="init" depends="properties">
|
||||||
|
<condition property="pluginTemp" value="${buildTempFolder}/plugins">
|
||||||
|
<isset property="buildTempFolder"/>
|
||||||
|
</condition>
|
||||||
|
<property name="pluginTemp" value="${basedir}"/>
|
||||||
|
<condition property="build.result.folder" value="${pluginTemp}/com.ibm.wala.core.testdata">
|
||||||
|
<isset property="buildTempFolder"/>
|
||||||
|
</condition>
|
||||||
|
<property name="build.result.folder" value="${basedir}"/>
|
||||||
|
<property name="temp.folder" value="${basedir}/temp.folder"/>
|
||||||
|
<property name="plugin.destination" value="${basedir}"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
<target name="properties" if="eclipse.running">
|
||||||
|
<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>
|
||||||
|
</target>
|
||||||
|
|
||||||
|
</project>
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<classpath>
|
<classpath>
|
||||||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
|
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||||
<classpathentry kind="src" path="harness-src"/>
|
<classpathentry kind="src" path="harness-src"/>
|
||||||
<classpathentry kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
|
|
|
@ -16,3 +16,4 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||||
org.junit4;bundle-version="4.3.1"
|
org.junit4;bundle-version="4.3.1"
|
||||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
|
Export-Package: com.ibm.wala.cast.js.test
|
||||||
|
|
|
@ -0,0 +1,177 @@
|
||||||
|
package com.ibm.wala.cast.js.rhino.test;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.MalformedURLException;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import junit.framework.Assert;
|
||||||
|
|
||||||
|
import org.eclipse.core.runtime.NullProgressMonitor;
|
||||||
|
|
||||||
|
import com.ibm.wala.cast.ir.translator.AstTranslator;
|
||||||
|
import com.ibm.wala.cast.js.ipa.callgraph.ForInContextSelector;
|
||||||
|
import com.ibm.wala.cast.js.ipa.callgraph.JSCFABuilder;
|
||||||
|
import com.ibm.wala.cast.js.ipa.callgraph.JavaScriptFunctionDotCallTargetSelector;
|
||||||
|
import com.ibm.wala.cast.js.ipa.callgraph.RecursionCheckContextSelector;
|
||||||
|
import com.ibm.wala.cast.js.ipa.callgraph.correlations.extraction.CorrelatedPairExtractorFactory;
|
||||||
|
import com.ibm.wala.cast.js.test.JSCallGraphBuilderUtil;
|
||||||
|
import com.ibm.wala.cast.js.test.JSCallGraphBuilderUtil.CGBuilderType;
|
||||||
|
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
|
||||||
|
import com.ibm.wala.ipa.callgraph.CGNode;
|
||||||
|
import com.ibm.wala.ipa.callgraph.CallGraph;
|
||||||
|
import com.ibm.wala.ipa.callgraph.CallGraphBuilderCancelException;
|
||||||
|
import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
||||||
|
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||||
|
import com.ibm.wala.util.ProgressMaster;
|
||||||
|
import com.ibm.wala.util.ProgressMonitorDelegate;
|
||||||
|
import com.ibm.wala.util.io.CommandLine;
|
||||||
|
import com.ibm.wala.util.io.FileProvider;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility class for building call graphs of HTML pages.
|
||||||
|
*
|
||||||
|
* @author mschaefer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class HTMLCGBuilder {
|
||||||
|
public static final int DEFAULT_TIMEOUT = 120;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple struct-like type to hold results of call graph construction.
|
||||||
|
*
|
||||||
|
* @author mschaefer
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static class CGBuilderResult {
|
||||||
|
/** time it took to build the call graph; {@code -1} if timeout occurred */
|
||||||
|
public long construction_time;
|
||||||
|
|
||||||
|
/** builder responsible for building the call graph*/
|
||||||
|
public JSCFABuilder builder;
|
||||||
|
|
||||||
|
/** pointer analysis results; partial if {@link #construction_time} is {@code -1} */
|
||||||
|
public PointerAnalysis pa;
|
||||||
|
|
||||||
|
/** call graph; partial if {@link #construction_time} is {@code -1} */
|
||||||
|
public CallGraph cg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build a call graph for an HTML page, optionally with a timeout.
|
||||||
|
*
|
||||||
|
* @param src
|
||||||
|
* the HTML page to analyse, can either be a path to a local file or a URL
|
||||||
|
* @param timeout
|
||||||
|
* analysis timeout in seconds, -1 means no timeout
|
||||||
|
* @param automated_extraction
|
||||||
|
* whether to automatically extract correlated pairs
|
||||||
|
* @throws IOException
|
||||||
|
* @throws ClassHierarchyException
|
||||||
|
*/
|
||||||
|
public static CGBuilderResult buildHTMLCG(String src, int timeout, boolean automated_extraction, CGBuilderType builderType)
|
||||||
|
throws ClassHierarchyException, IOException {
|
||||||
|
CGBuilderResult res = new CGBuilderResult();
|
||||||
|
URL url = null;
|
||||||
|
try {
|
||||||
|
url = toUrl(src);
|
||||||
|
} catch (MalformedURLException e1) {
|
||||||
|
Assert.fail("Could not find page to analyse: " + src);
|
||||||
|
}
|
||||||
|
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
||||||
|
if(automated_extraction)
|
||||||
|
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setPreprocessor(new CorrelatedPairExtractorFactory(new CAstRhinoTranslatorFactory(), url));
|
||||||
|
JSCFABuilder builder = null;
|
||||||
|
try {
|
||||||
|
builder = JSCallGraphBuilderUtil.makeHTMLCGBuilder(url, builderType);
|
||||||
|
builder.setContextSelector(new ForInContextSelector(2, builder.getContextSelector()));
|
||||||
|
builder.setContextSelector(new ForInContextSelector(3, builder.getContextSelector()));
|
||||||
|
// TODO we need to find a better way to do this ContextSelector delegation;
|
||||||
|
// the code below belongs somewhere else!!!
|
||||||
|
// the bound of 4 is what is needed to pass our current framework tests
|
||||||
|
if (AstTranslator.NEW_LEXICAL) {
|
||||||
|
// builder.setContextSelector(new RecursionBoundContextSelector(builder.getContextSelector(), 4));
|
||||||
|
builder.setContextSelector(new RecursionCheckContextSelector(builder.getContextSelector()));
|
||||||
|
}
|
||||||
|
ProgressMaster master = ProgressMaster.make(new NullProgressMonitor());
|
||||||
|
if (timeout > 0) {
|
||||||
|
master.setMillisPerWorkItem(timeout * 1000);
|
||||||
|
master.beginTask("runSolver", 1);
|
||||||
|
}
|
||||||
|
long start = System.currentTimeMillis();
|
||||||
|
CallGraph cg = timeout > 0 ? builder.makeCallGraph(builder.getOptions(),
|
||||||
|
ProgressMonitorDelegate.createProgressMonitorDelegate(master)) : builder.makeCallGraph(builder.getOptions());
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
master.done();
|
||||||
|
res.construction_time = (end - start);
|
||||||
|
res.cg = cg;
|
||||||
|
res.pa = builder.getPointerAnalysis();
|
||||||
|
res.builder = builder;
|
||||||
|
return res;
|
||||||
|
} catch (CallGraphBuilderCancelException e) {
|
||||||
|
res.construction_time = -1;
|
||||||
|
res.cg = e.getPartialCallGraph();
|
||||||
|
res.pa = e.getPartialPointerAnalysis();
|
||||||
|
res.builder = builder;
|
||||||
|
return res;
|
||||||
|
} catch (Exception e) {
|
||||||
|
throw new Error(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static URL toUrl(String src) throws MalformedURLException {
|
||||||
|
// first try interpreting as local file name, if that doesn't work just
|
||||||
|
// assume it's a URL
|
||||||
|
try {
|
||||||
|
File f = FileProvider.getFileFromClassLoader(src, HTMLCGBuilder.class.getClassLoader());
|
||||||
|
URL url = f.toURI().toURL();
|
||||||
|
return url;
|
||||||
|
} catch (FileNotFoundException fnfe) {
|
||||||
|
return new URL(src);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Usage: HTMLCGBuilder -src path_to_html_file -timeout timeout_in_seconds -reachable function_name
|
||||||
|
* timeout argument is optional and defaults to {@link #DEFAULT_TIMEOUT}.
|
||||||
|
* reachable argument is optional. if provided, and some reachable function name contains function_name,
|
||||||
|
* will print "REACHABLE"
|
||||||
|
* @throws IOException
|
||||||
|
* @throws ClassHierarchyException
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public static void main(String[] args) throws ClassHierarchyException, IOException {
|
||||||
|
Properties parsedArgs = CommandLine.parse(args);
|
||||||
|
String src = parsedArgs.getProperty("src");
|
||||||
|
if (src == null) {
|
||||||
|
throw new IllegalArgumentException("-src argument is required");
|
||||||
|
}
|
||||||
|
int timeout;
|
||||||
|
if (parsedArgs.containsKey("timeout")) {
|
||||||
|
timeout = Integer.parseInt(parsedArgs.getProperty("timeout"));
|
||||||
|
} else {
|
||||||
|
timeout = DEFAULT_TIMEOUT;
|
||||||
|
}
|
||||||
|
String reachableName = null;
|
||||||
|
if (parsedArgs.containsKey("reachable")) {
|
||||||
|
reachableName = parsedArgs.getProperty("reachable");
|
||||||
|
}
|
||||||
|
// suppress debug output
|
||||||
|
JavaScriptFunctionDotCallTargetSelector.WARN_ABOUT_IMPRECISE_CALLGRAPH = false;
|
||||||
|
CGBuilderResult res = buildHTMLCG(src, timeout, true, AstTranslator.NEW_LEXICAL ? CGBuilderType.ONE_CFA_PRECISE_LEXICAL : CGBuilderType.ZERO_ONE_CFA);
|
||||||
|
if(res.construction_time == -1)
|
||||||
|
System.out.println("TIMED OUT");
|
||||||
|
else
|
||||||
|
System.out.println("Call graph construction took " + res.construction_time/1000.0 + " seconds");
|
||||||
|
if (reachableName != null) {
|
||||||
|
for (CGNode node : res.cg) {
|
||||||
|
if (node.getMethod().getDeclaringClass().getName().toString().contains(reachableName)) {
|
||||||
|
System.out.println("REACHABLE");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -22,7 +22,7 @@ public class TestAjaxsltCallGraphShapeRhino extends TestAjaxsltCallGraphShape {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.ibm.wala.cast.js.test;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
|
||||||
|
import com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil;
|
||||||
|
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
|
||||||
|
|
||||||
|
public class TestArgumentSensitivityRhino extends TestArgumentSensitivity {
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2011 IBM Corporation.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package com.ibm.wala.cast.js.test;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
import com.ibm.wala.cast.js.ipa.callgraph.correlations.CorrelationFinder;
|
||||||
|
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
|
||||||
|
import com.ibm.wala.cast.js.translator.RhinoToAstTranslator;
|
||||||
|
import com.ibm.wala.cast.tree.CAstEntity;
|
||||||
|
import com.ibm.wala.cast.tree.impl.CAstImpl;
|
||||||
|
import com.ibm.wala.classLoader.SourceModule;
|
||||||
|
|
||||||
|
public class TestCorrelatedPairExtractionRhino extends TestCorrelatedPairExtraction {
|
||||||
|
protected CorrelationFinder makeCorrelationFinder() {
|
||||||
|
return new CorrelationFinder(new CAstRhinoTranslatorFactory());
|
||||||
|
}
|
||||||
|
|
||||||
|
protected CAstEntity parseJS(CAstImpl ast, SourceModule module) throws IOException {
|
||||||
|
RhinoToAstTranslator translator = new RhinoToAstTranslator(ast, module, module.getName(), false);
|
||||||
|
CAstEntity entity = translator.translateToCAst();
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*******************************************************************************
|
||||||
|
* Copyright (c) 2011 IBM Corporation.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/epl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* IBM Corporation - initial API and implementation
|
||||||
|
*******************************************************************************/
|
||||||
|
|
||||||
|
package com.ibm.wala.cast.js.test;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ibm.wala.cast.js.translator.RhinoToAstTranslator;
|
||||||
|
import com.ibm.wala.cast.tree.CAstEntity;
|
||||||
|
import com.ibm.wala.cast.tree.impl.CAstImpl;
|
||||||
|
import com.ibm.wala.classLoader.SourceModule;
|
||||||
|
|
||||||
|
public class TestForInBodyExtractionRhino extends TestForInBodyExtraction {
|
||||||
|
protected CAstEntity parseJS(CAstImpl ast, SourceModule module) throws IOException {
|
||||||
|
RhinoToAstTranslator translator = new RhinoToAstTranslator(ast, module, module.getName(), false);
|
||||||
|
CAstEntity entity = translator.translateToCAst();
|
||||||
|
return entity;
|
||||||
|
}
|
||||||
|
}
|
|
@ -8,7 +8,7 @@ public class TestForInLoopHackRhino extends TestForInLoopHack {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
package com.ibm.wala.cast.js.test;
|
||||||
|
|
||||||
|
import org.junit.Before;
|
||||||
|
|
||||||
|
import com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil;
|
||||||
|
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
|
||||||
|
|
||||||
|
public class TestJQueryExamplesRhino extends TestJQueryExamples {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
justThisTest(TestJQueryExamplesRhino.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Before
|
||||||
|
public void setUp() {
|
||||||
|
JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -22,7 +22,7 @@ public class TestMediawikiCallGraphShapeRhino extends TestMediawikiCallGraphShap
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class TestMozillaBugPagesRhino extends TestMozillaBugPages {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,12 +28,12 @@ public class TestSimpleCallGraphShapeRhino extends TestSimpleCallGraphShape {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test214631() throws IOException, IllegalArgumentException, CancelException {
|
public void test214631() throws IOException, IllegalArgumentException, CancelException {
|
||||||
JSCFABuilder b = Util.makeScriptCGBuilder("tests", "214631.js");
|
JSCFABuilder b = JSCallGraphBuilderUtil.makeScriptCGBuilder("tests", "214631.js");
|
||||||
b.makeCallGraph(b.getOptions());
|
b.makeCallGraph(b.getOptions());
|
||||||
PointerAnalysis PA = b.getPointerAnalysis();
|
PointerAnalysis PA = b.getPointerAnalysis();
|
||||||
// just make sure this does not crash
|
// just make sure this does not crash
|
||||||
|
@ -42,22 +42,27 @@ public class TestSimpleCallGraphShapeRhino extends TestSimpleCallGraphShape {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRewriterDoesNotChangeLablesBug() throws IOException, IllegalArgumentException, CancelException {
|
public void testRewriterDoesNotChangeLablesBug() throws IOException, IllegalArgumentException, CancelException {
|
||||||
Util.makeScriptCG("tests", "rewrite_does_not_change_lables_bug.js");
|
JSCallGraphBuilderUtil.makeScriptCG("tests", "rewrite_does_not_change_lables_bug.js");
|
||||||
// all we need is for it to finish building CG successfully.
|
// all we need is for it to finish building CG successfully.
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testRepr() throws IllegalArgumentException, IOException, CancelException {
|
public void testRepr() throws IllegalArgumentException, IOException, CancelException {
|
||||||
Util.makeScriptCG("tests", "repr.js");
|
JSCallGraphBuilderUtil.makeScriptCG("tests", "repr.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTranslateToCAstCrash1() throws IllegalArgumentException, IOException, CancelException {
|
public void testTranslateToCAstCrash1() throws IllegalArgumentException, IOException, CancelException {
|
||||||
Util.makeScriptCG("tests", "rhino_crash1.js");
|
JSCallGraphBuilderUtil.makeScriptCG("tests", "rhino_crash1.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testTranslateToCAstCrash2() throws IllegalArgumentException, IOException, CancelException {
|
public void testTranslateToCAstCrash2() throws IllegalArgumentException, IOException, CancelException {
|
||||||
Util.makeScriptCG("tests", "rhino_crash2.js");
|
JSCallGraphBuilderUtil.makeScriptCG("tests", "rhino_crash2.js");
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testTranslateToCAstCrash3() throws IllegalArgumentException, IOException, CancelException {
|
||||||
|
JSCallGraphBuilderUtil.makeScriptCG("tests", "rhino_crash3.js");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public abstract class TestSimplePageCallGraphShapeRhino extends TestSimplePageCa
|
||||||
|
|
||||||
@Test public void testPage3() throws IOException, IllegalArgumentException, CancelException {
|
@Test public void testPage3() throws IOException, IllegalArgumentException, CancelException {
|
||||||
URL url = getClass().getClassLoader().getResource("pages/page3.html");
|
URL url = getClass().getClassLoader().getResource("pages/page3.html");
|
||||||
CallGraph CG = Util.makeHTMLCG(url);
|
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
|
||||||
verifyGraphAssertions(CG, assertionsForPage3);
|
verifyGraphAssertions(CG, assertionsForPage3);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ public abstract class TestSimplePageCallGraphShapeRhino extends TestSimplePageCa
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
com.ibm.wala.cast.js.ipa.callgraph.Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
com.ibm.wala.cast.js.ipa.callgraph.JSCallGraphUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
||||||
WebUtil.setFactory(new IHtmlParserFactory() {
|
WebUtil.setFactory(new IHtmlParserFactory() {
|
||||||
public IHtmlParser getParser() {
|
public IHtmlParser getParser() {
|
||||||
return TestSimplePageCallGraphShapeRhino.this.getParser();
|
return TestSimplePageCallGraphShapeRhino.this.getParser();
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class TestSimplePageCallGraphShapeRhinoJericho extends TestSimplePageCall
|
||||||
|
|
||||||
@Test public void testCrawl() throws IOException, IllegalArgumentException, CancelException {
|
@Test public void testCrawl() throws IOException, IllegalArgumentException, CancelException {
|
||||||
URL url = getClass().getClassLoader().getResource("pages/crawl.html");
|
URL url = getClass().getClassLoader().getResource("pages/crawl.html");
|
||||||
CallGraph CG = Util.makeHTMLCG(url);
|
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url);
|
||||||
verifyGraphAssertions(CG, null);
|
verifyGraphAssertions(CG, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import java.io.IOException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import com.ibm.wala.cast.ir.ssa.AstIRFactory;
|
||||||
import com.ibm.wala.cast.js.html.DefaultSourceExtractor;
|
import com.ibm.wala.cast.js.html.DefaultSourceExtractor;
|
||||||
import com.ibm.wala.cast.js.html.DomLessSourceExtractor;
|
import com.ibm.wala.cast.js.html.DomLessSourceExtractor;
|
||||||
import com.ibm.wala.cast.js.html.IdentityUrlResolver;
|
import com.ibm.wala.cast.js.html.IdentityUrlResolver;
|
||||||
|
@ -14,7 +15,7 @@ import com.ibm.wala.cast.js.html.WebUtil;
|
||||||
import com.ibm.wala.cast.js.html.jericho.JerichoHtmlParser;
|
import com.ibm.wala.cast.js.html.jericho.JerichoHtmlParser;
|
||||||
import com.ibm.wala.cast.js.ipa.callgraph.JSCFABuilder;
|
import com.ibm.wala.cast.js.ipa.callgraph.JSCFABuilder;
|
||||||
import com.ibm.wala.cast.js.loader.JavaScriptLoader;
|
import com.ibm.wala.cast.js.loader.JavaScriptLoader;
|
||||||
import com.ibm.wala.cast.js.test.Util;
|
import com.ibm.wala.cast.js.test.JSCallGraphBuilderUtil;
|
||||||
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
|
import com.ibm.wala.cast.js.translator.CAstRhinoTranslatorFactory;
|
||||||
import com.ibm.wala.classLoader.SourceFileModule;
|
import com.ibm.wala.classLoader.SourceFileModule;
|
||||||
import com.ibm.wala.classLoader.SourceModule;
|
import com.ibm.wala.classLoader.SourceModule;
|
||||||
|
@ -23,7 +24,7 @@ import com.ibm.wala.ipa.callgraph.propagation.PointerAnalysis;
|
||||||
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
import com.ibm.wala.ipa.cha.ClassHierarchyException;
|
||||||
import com.ibm.wala.util.CancelException;
|
import com.ibm.wala.util.CancelException;
|
||||||
|
|
||||||
public class JsViewerDriver extends Util {
|
public class JsViewerDriver extends JSCallGraphBuilderUtil {
|
||||||
public static void main(String args[]) throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException {
|
public static void main(String args[]) throws ClassHierarchyException, IllegalArgumentException, IOException, CancelException {
|
||||||
|
|
||||||
if (args.length != 1){
|
if (args.length != 1){
|
||||||
|
@ -35,13 +36,13 @@ public class JsViewerDriver extends Util {
|
||||||
URL url = new URL(args[0]);
|
URL url = new URL(args[0]);
|
||||||
|
|
||||||
// computing CG + PA
|
// computing CG + PA
|
||||||
Util.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
JSCallGraphBuilderUtil.setTranslatorFactory(new CAstRhinoTranslatorFactory());
|
||||||
JavaScriptLoader.addBootstrapFile(WebUtil.preamble);
|
JavaScriptLoader.addBootstrapFile(WebUtil.preamble);
|
||||||
|
|
||||||
SourceModule[] sources = getSources(domless, url);
|
SourceModule[] sources = getSources(domless, url);
|
||||||
|
|
||||||
JSCFABuilder builder = makeCGBuilder(new WebPageLoaderFactory(translatorFactory), sources, false);
|
JSCFABuilder builder = makeCGBuilder(new WebPageLoaderFactory(translatorFactory), sources, CGBuilderType.ZERO_ONE_CFA, AstIRFactory.makeDefaultFactory());
|
||||||
builder.setBaseURL(url);
|
builder.setBaseURL(url);
|
||||||
|
|
||||||
CallGraph cg = builder.makeCallGraph(builder.getOptions());
|
CallGraph cg = builder.makeCallGraph(builder.getOptions());
|
||||||
PointerAnalysis pa = builder.getPointerAnalysis();
|
PointerAnalysis pa = builder.getPointerAnalysis();
|
||||||
|
|
|
@ -1,7 +1,344 @@
|
||||||
#Tue Jun 23 17:02:07 EDT 2009
|
#Thu Feb 03 10:12:26 EST 2011
|
||||||
eclipse.preferences.version=1
|
eclipse.preferences.version=1
|
||||||
|
instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
|
||||||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
|
||||||
|
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
|
||||||
org.eclipse.jdt.core.compiler.compliance=1.5
|
org.eclipse.jdt.core.compiler.compliance=1.5
|
||||||
|
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=warning
|
||||||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.emptyStatement=ignore
|
||||||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fallthroughCase=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
|
||||||
|
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadoc=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTags=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsDeprecatedRef=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsNotVisibleRef=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.invalidJavadocTagsVisibility=public
|
||||||
|
org.eclipse.jdt.core.compiler.problem.localVariableHiding=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsOverriding=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsOverriding=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingJavadocTagsVisibility=public
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.missingSerialVersion=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.nullReference=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedImport=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
|
||||||
|
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning
|
||||||
|
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
|
||||||
org.eclipse.jdt.core.compiler.source=1.5
|
org.eclipse.jdt.core.compiler.source=1.5
|
||||||
|
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_assignment=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_binary_expression=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_compact_if=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=80
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=16
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_after_package=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_field=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_method=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_before_package=0
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
|
||||||
|
org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
|
||||||
|
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=false
|
||||||
|
org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=false
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_block_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_header=false
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_html=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_line_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.format_source_code=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
|
||||||
|
org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.comment.line_length=80
|
||||||
|
org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
|
||||||
|
org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
|
||||||
|
org.eclipse.jdt.core.formatter.compact_else_if=true
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation=2
|
||||||
|
org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
|
||||||
|
org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
|
||||||
|
org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
|
||||||
|
org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_empty_lines=false
|
||||||
|
org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
|
||||||
|
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=false
|
||||||
|
org.eclipse.jdt.core.formatter.indentation.size=2
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
|
||||||
|
org.eclipse.jdt.core.formatter.join_lines_in_comments=true
|
||||||
|
org.eclipse.jdt.core.formatter.join_wrapped_lines=true
|
||||||
|
org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=false
|
||||||
|
org.eclipse.jdt.core.formatter.lineSplit=132
|
||||||
|
org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=false
|
||||||
|
org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=false
|
||||||
|
org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
|
||||||
|
org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
|
||||||
|
org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
|
||||||
|
org.eclipse.jdt.core.formatter.tabulation.char=space
|
||||||
|
org.eclipse.jdt.core.formatter.tabulation.size=2
|
||||||
|
org.eclipse.jdt.core.formatter.use_on_off_tags=false
|
||||||
|
org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=false
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
|
||||||
|
org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
|
||||||
|
|
File diff suppressed because one or more lines are too long
|
@ -11,4 +11,5 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||||
com.ibm.wala.core;bundle-version="1.1.3"
|
com.ibm.wala.core;bundle-version="1.1.3"
|
||||||
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
Bundle-RequiredExecutionEnvironment: J2SE-1.5
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Export-Package: com.ibm.wala.cast.js.translator
|
Export-Package: com.ibm.wala.cast.js.translator,
|
||||||
|
org.mozilla.javascript
|
||||||
|
|
|
@ -39,9 +39,9 @@
|
||||||
<target name="fetchRhino" depends="RhinoPresent" unless="rhino.present">
|
<target name="fetchRhino" depends="RhinoPresent" unless="rhino.present">
|
||||||
<delete dir="${temp.folder}"/>
|
<delete dir="${temp.folder}"/>
|
||||||
<mkdir dir="${temp.folder}"/>
|
<mkdir dir="${temp.folder}"/>
|
||||||
<get src="http://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R2.zip" dest="${temp.folder}/rhino1_7R2.zip" />
|
<get src="http://ftp.mozilla.org/pub/mozilla.org/js/rhino1_7R3.zip" dest="${temp.folder}/rhino1_7R3.zip" />
|
||||||
<unzip src="${temp.folder}/rhino1_7R2.zip" dest="${temp.folder}"/>
|
<unzip src="${temp.folder}/rhino1_7R3.zip" dest="${temp.folder}"/>
|
||||||
<copy file="${temp.folder}/rhino1_7R2/js.jar" tofile="${plugin.destination}/lib/js.jar" />
|
<copy file="${temp.folder}/rhino1_7R3/js.jar" tofile="${plugin.destination}/lib/js.jar" />
|
||||||
<delete dir="${temp.folder}"/>
|
<delete dir="${temp.folder}"/>
|
||||||
</target>
|
</target>
|
||||||
|
|
||||||
|
|
|
@ -11,23 +11,35 @@
|
||||||
package com.ibm.wala.cast.js.translator;
|
package com.ibm.wala.cast.js.translator;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.LinkedList;
|
||||||
import org.mozilla.javascript.RhinoToAstTranslator;
|
import java.util.List;
|
||||||
|
|
||||||
import com.ibm.wala.cast.ir.translator.TranslatorToCAst;
|
import com.ibm.wala.cast.ir.translator.TranslatorToCAst;
|
||||||
import com.ibm.wala.cast.tree.CAstEntity;
|
import com.ibm.wala.cast.tree.CAstEntity;
|
||||||
import com.ibm.wala.cast.tree.impl.CAstImpl;
|
import com.ibm.wala.cast.tree.impl.CAstImpl;
|
||||||
|
import com.ibm.wala.cast.tree.impl.CAstRewriter.CopyKey;
|
||||||
|
import com.ibm.wala.cast.tree.impl.CAstRewriter.RewriteContext;
|
||||||
|
import com.ibm.wala.cast.tree.impl.CAstRewriterFactory;
|
||||||
import com.ibm.wala.classLoader.SourceFileModule;
|
import com.ibm.wala.classLoader.SourceFileModule;
|
||||||
import com.ibm.wala.classLoader.SourceModule;
|
import com.ibm.wala.classLoader.SourceModule;
|
||||||
|
|
||||||
public class CAstRhinoTranslator implements TranslatorToCAst {
|
public class CAstRhinoTranslator implements TranslatorToCAst {
|
||||||
|
private final List<CAstRewriterFactory> rewriters = new LinkedList<CAstRewriterFactory>();
|
||||||
private final SourceModule M;
|
private final SourceModule M;
|
||||||
|
private final boolean replicateForDoLoops;
|
||||||
public CAstRhinoTranslator(SourceModule M) {
|
|
||||||
|
public CAstRhinoTranslator(SourceModule M, boolean replicateForDoLoops) {
|
||||||
this.M = M;
|
this.M = M;
|
||||||
|
this.replicateForDoLoops = replicateForDoLoops;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public <C extends RewriteContext<K>, K extends CopyKey<K>> void addRewriter(CAstRewriterFactory<C, K> factory, boolean prepend) {
|
||||||
|
if(prepend)
|
||||||
|
rewriters.add(0, factory);
|
||||||
|
else
|
||||||
|
rewriters.add(factory);
|
||||||
|
}
|
||||||
|
|
||||||
public CAstEntity translateToCAst() throws IOException {
|
public CAstEntity translateToCAst() throws IOException {
|
||||||
String N;
|
String N;
|
||||||
if (M instanceof SourceFileModule) {
|
if (M instanceof SourceFileModule) {
|
||||||
|
@ -37,9 +49,10 @@ public class CAstRhinoTranslator implements TranslatorToCAst {
|
||||||
}
|
}
|
||||||
|
|
||||||
CAstImpl Ast = new CAstImpl();
|
CAstImpl Ast = new CAstImpl();
|
||||||
|
CAstEntity entity = new RhinoToAstTranslator(Ast, M, N, replicateForDoLoops).translateToCAst();
|
||||||
return
|
for(CAstRewriterFactory rwf : rewriters)
|
||||||
new PropertyReadExpander(Ast).rewrite(
|
entity = rwf.createCAstRewriter(Ast).rewrite(entity);
|
||||||
new RhinoToAstTranslator(Ast, M, N).translate());
|
return entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@ import com.ibm.wala.classLoader.SourceModule;
|
||||||
public class CAstRhinoTranslatorFactory implements JavaScriptTranslatorFactory {
|
public class CAstRhinoTranslatorFactory implements JavaScriptTranslatorFactory {
|
||||||
|
|
||||||
public TranslatorToCAst make(CAst ast, SourceModule M) {
|
public TranslatorToCAst make(CAst ast, SourceModule M) {
|
||||||
return new CAstRhinoTranslator(M);
|
return new CAstRhinoTranslator(M, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,303 @@
|
||||||
|
package com.ibm.wala.cast.js.translator;
|
||||||
|
|
||||||
|
import org.mozilla.javascript.ast.ArrayComprehension;
|
||||||
|
import org.mozilla.javascript.ast.ArrayComprehensionLoop;
|
||||||
|
import org.mozilla.javascript.ast.ArrayLiteral;
|
||||||
|
import org.mozilla.javascript.ast.Assignment;
|
||||||
|
import org.mozilla.javascript.ast.AstNode;
|
||||||
|
import org.mozilla.javascript.ast.AstRoot;
|
||||||
|
import org.mozilla.javascript.ast.Block;
|
||||||
|
import org.mozilla.javascript.ast.BreakStatement;
|
||||||
|
import org.mozilla.javascript.ast.CatchClause;
|
||||||
|
import org.mozilla.javascript.ast.Comment;
|
||||||
|
import org.mozilla.javascript.ast.ConditionalExpression;
|
||||||
|
import org.mozilla.javascript.ast.ContinueStatement;
|
||||||
|
import org.mozilla.javascript.ast.DoLoop;
|
||||||
|
import org.mozilla.javascript.ast.ElementGet;
|
||||||
|
import org.mozilla.javascript.ast.EmptyExpression;
|
||||||
|
import org.mozilla.javascript.ast.ErrorNode;
|
||||||
|
import org.mozilla.javascript.ast.ExpressionStatement;
|
||||||
|
import org.mozilla.javascript.ast.ForInLoop;
|
||||||
|
import org.mozilla.javascript.ast.ForLoop;
|
||||||
|
import org.mozilla.javascript.ast.FunctionCall;
|
||||||
|
import org.mozilla.javascript.ast.FunctionNode;
|
||||||
|
import org.mozilla.javascript.ast.IfStatement;
|
||||||
|
import org.mozilla.javascript.ast.InfixExpression;
|
||||||
|
import org.mozilla.javascript.ast.Jump;
|
||||||
|
import org.mozilla.javascript.ast.KeywordLiteral;
|
||||||
|
import org.mozilla.javascript.ast.Label;
|
||||||
|
import org.mozilla.javascript.ast.LabeledStatement;
|
||||||
|
import org.mozilla.javascript.ast.LetNode;
|
||||||
|
import org.mozilla.javascript.ast.Name;
|
||||||
|
import org.mozilla.javascript.ast.NewExpression;
|
||||||
|
import org.mozilla.javascript.ast.NumberLiteral;
|
||||||
|
import org.mozilla.javascript.ast.ObjectLiteral;
|
||||||
|
import org.mozilla.javascript.ast.ObjectProperty;
|
||||||
|
import org.mozilla.javascript.ast.ParenthesizedExpression;
|
||||||
|
import org.mozilla.javascript.ast.PropertyGet;
|
||||||
|
import org.mozilla.javascript.ast.RegExpLiteral;
|
||||||
|
import org.mozilla.javascript.ast.ReturnStatement;
|
||||||
|
import org.mozilla.javascript.ast.Scope;
|
||||||
|
import org.mozilla.javascript.ast.ScriptNode;
|
||||||
|
import org.mozilla.javascript.ast.StringLiteral;
|
||||||
|
import org.mozilla.javascript.ast.SwitchCase;
|
||||||
|
import org.mozilla.javascript.ast.SwitchStatement;
|
||||||
|
import org.mozilla.javascript.ast.Symbol;
|
||||||
|
import org.mozilla.javascript.ast.ThrowStatement;
|
||||||
|
import org.mozilla.javascript.ast.TryStatement;
|
||||||
|
import org.mozilla.javascript.ast.UnaryExpression;
|
||||||
|
import org.mozilla.javascript.ast.VariableDeclaration;
|
||||||
|
import org.mozilla.javascript.ast.VariableInitializer;
|
||||||
|
import org.mozilla.javascript.ast.WhileLoop;
|
||||||
|
import org.mozilla.javascript.ast.WithStatement;
|
||||||
|
import org.mozilla.javascript.ast.XmlDotQuery;
|
||||||
|
import org.mozilla.javascript.ast.XmlElemRef;
|
||||||
|
import org.mozilla.javascript.ast.XmlExpression;
|
||||||
|
import org.mozilla.javascript.ast.XmlFragment;
|
||||||
|
import org.mozilla.javascript.ast.XmlLiteral;
|
||||||
|
import org.mozilla.javascript.ast.XmlMemberGet;
|
||||||
|
import org.mozilla.javascript.ast.XmlPropRef;
|
||||||
|
import org.mozilla.javascript.ast.XmlRef;
|
||||||
|
import org.mozilla.javascript.ast.XmlString;
|
||||||
|
import org.mozilla.javascript.ast.Yield;
|
||||||
|
|
||||||
|
public abstract class TypedNodeVisitor<R,A> {
|
||||||
|
|
||||||
|
public R visit(AstNode node, A arg) {
|
||||||
|
if (node instanceof ArrayComprehension) {
|
||||||
|
return visitArrayComprehension((ArrayComprehension) node, arg);
|
||||||
|
} else if (node instanceof WhileLoop) {
|
||||||
|
return visitWhileLoop((WhileLoop) node, arg);
|
||||||
|
} else if (node instanceof ArrayComprehensionLoop) {
|
||||||
|
return visitArrayComprehensionLoop((ArrayComprehensionLoop) node, arg);
|
||||||
|
} else if (node instanceof ArrayLiteral) {
|
||||||
|
return visitArrayLiteral((ArrayLiteral) node, arg);
|
||||||
|
} else if (node instanceof Assignment) {
|
||||||
|
return visitAssignment((Assignment) node, arg);
|
||||||
|
} else if (node instanceof AstRoot) {
|
||||||
|
return visitAstRoot((AstRoot) node, arg);
|
||||||
|
} else if (node instanceof Block) {
|
||||||
|
return visitBlock((Block) node, arg);
|
||||||
|
} else if (node instanceof BreakStatement) {
|
||||||
|
return visitBreakStatement((BreakStatement) node, arg);
|
||||||
|
} else if (node instanceof CatchClause) {
|
||||||
|
return visitCatchClause((CatchClause) node, arg);
|
||||||
|
} else if (node instanceof Comment) {
|
||||||
|
return visitComment((Comment) node, arg);
|
||||||
|
} else if (node instanceof ConditionalExpression) {
|
||||||
|
return visitConditionalExpression((ConditionalExpression) node, arg);
|
||||||
|
} else if (node instanceof ContinueStatement) {
|
||||||
|
return visitContinueStatement((ContinueStatement) node, arg);
|
||||||
|
} else if (node instanceof DoLoop) {
|
||||||
|
return visitDoLoop((DoLoop) node, arg);
|
||||||
|
} else if (node instanceof ElementGet) {
|
||||||
|
return visitElementGet((ElementGet) node, arg);
|
||||||
|
} else if (node instanceof EmptyExpression) {
|
||||||
|
return visitEmptyExpression((EmptyExpression) node, arg);
|
||||||
|
} else if (node instanceof ErrorNode) {
|
||||||
|
return visitErrorNode((ErrorNode) node, arg);
|
||||||
|
} else if (node instanceof ExpressionStatement) {
|
||||||
|
return visitExpressionStatement((ExpressionStatement) node, arg);
|
||||||
|
} else if (node instanceof ForInLoop) {
|
||||||
|
return visitForInLoop((ForInLoop) node, arg);
|
||||||
|
} else if (node instanceof ForLoop) {
|
||||||
|
return visitForLoop((ForLoop) node, arg);
|
||||||
|
} else if (node instanceof NewExpression) {
|
||||||
|
return visitNewExpression((NewExpression) node, arg);
|
||||||
|
} else if (node instanceof FunctionCall) {
|
||||||
|
return visitFunctionCall((FunctionCall) node, arg);
|
||||||
|
} else if (node instanceof FunctionNode) {
|
||||||
|
return visitFunctionNode((FunctionNode) node, arg);
|
||||||
|
} else if (node instanceof IfStatement) {
|
||||||
|
return visitIfStatement((IfStatement) node, arg);
|
||||||
|
} else if (node instanceof KeywordLiteral) {
|
||||||
|
return visitKeywordLiteral((KeywordLiteral) node, arg);
|
||||||
|
} else if (node instanceof Label) {
|
||||||
|
return visitLabel((Label) node, arg);
|
||||||
|
} else if (node instanceof LabeledStatement) {
|
||||||
|
return visitLabeledStatement((LabeledStatement) node, arg);
|
||||||
|
} else if (node instanceof LetNode) {
|
||||||
|
return visitLetNode((LetNode) node, arg);
|
||||||
|
} else if (node instanceof Name) {
|
||||||
|
return visitName((Name) node, arg);
|
||||||
|
} else if (node instanceof NumberLiteral) {
|
||||||
|
return visitNumberLiteral((NumberLiteral) node, arg);
|
||||||
|
} else if (node instanceof ObjectLiteral) {
|
||||||
|
return visitObjectLiteral((ObjectLiteral) node, arg);
|
||||||
|
} else if (node instanceof ObjectProperty) {
|
||||||
|
return visitObjectProperty((ObjectProperty) node, arg);
|
||||||
|
} else if (node instanceof ParenthesizedExpression) {
|
||||||
|
return visitParenthesizedExpression((ParenthesizedExpression) node, arg);
|
||||||
|
} else if (node instanceof PropertyGet) {
|
||||||
|
return visitPropertyGet((PropertyGet) node, arg);
|
||||||
|
} else if (node instanceof RegExpLiteral) {
|
||||||
|
return visitRegExpLiteral((RegExpLiteral) node, arg);
|
||||||
|
} else if (node instanceof ReturnStatement) {
|
||||||
|
return visitReturnStatement((ReturnStatement) node, arg);
|
||||||
|
} else if (node instanceof Scope) {
|
||||||
|
return visitScope((Scope) node, arg);
|
||||||
|
} else if (node instanceof ScriptNode) {
|
||||||
|
return visitScriptNode((ScriptNode) node, arg);
|
||||||
|
} else if (node instanceof StringLiteral) {
|
||||||
|
return visitStringLiteral((StringLiteral) node, arg);
|
||||||
|
} else if (node instanceof SwitchCase) {
|
||||||
|
return visitSwitchCase((SwitchCase) node, arg);
|
||||||
|
} else if (node instanceof SwitchStatement) {
|
||||||
|
return visitSwitchStatement((SwitchStatement) node, arg);
|
||||||
|
} else if (node instanceof ThrowStatement) {
|
||||||
|
return visitThrowStatement((ThrowStatement) node, arg);
|
||||||
|
} else if (node instanceof TryStatement) {
|
||||||
|
return visitTryStatement((TryStatement) node, arg);
|
||||||
|
} else if (node instanceof UnaryExpression) {
|
||||||
|
return visitUnaryExpression((UnaryExpression) node, arg);
|
||||||
|
} else if (node instanceof VariableDeclaration) {
|
||||||
|
return visitVariableDeclaration((VariableDeclaration) node, arg);
|
||||||
|
} else if (node instanceof VariableInitializer) {
|
||||||
|
return visitVariableInitializer((VariableInitializer) node, arg);
|
||||||
|
} else if (node instanceof WithStatement) {
|
||||||
|
return visitWithStatement((WithStatement) node, arg);
|
||||||
|
} else if (node instanceof XmlDotQuery) {
|
||||||
|
return visitXmlDotQuery((XmlDotQuery) node, arg);
|
||||||
|
} else if (node instanceof XmlElemRef) {
|
||||||
|
return visitXmlElemRef((XmlElemRef) node, arg);
|
||||||
|
} else if (node instanceof XmlExpression) {
|
||||||
|
return visitXmlExpression((XmlExpression) node, arg);
|
||||||
|
} else if (node instanceof XmlLiteral) {
|
||||||
|
return visitXmlLiteral((XmlLiteral) node, arg);
|
||||||
|
} else if (node instanceof XmlMemberGet) {
|
||||||
|
return visitXmlMemberGet((XmlMemberGet) node, arg);
|
||||||
|
} else if (node instanceof XmlPropRef) {
|
||||||
|
return visitXmlPropRef((XmlPropRef) node, arg);
|
||||||
|
} else if (node instanceof XmlString) {
|
||||||
|
return visitXmlString((XmlString) node, arg);
|
||||||
|
} else if (node instanceof Yield) {
|
||||||
|
return visitYield((Yield) node, arg);
|
||||||
|
} else if (node instanceof InfixExpression) {
|
||||||
|
return visitInfixExpression((InfixExpression) node, arg);
|
||||||
|
} else if (node instanceof Jump) {
|
||||||
|
return visitJump((Jump) node, arg);
|
||||||
|
} else {
|
||||||
|
throw new Error("unexpected node type " + node.getClass().getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract R visitArrayComprehension(ArrayComprehension node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitArrayComprehensionLoop(ArrayComprehensionLoop node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitArrayLiteral(ArrayLiteral node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitAssignment(Assignment node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitAstRoot(AstRoot node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitBlock(Block node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitBreakStatement(BreakStatement node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitCatchClause(CatchClause node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitComment(Comment node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitConditionalExpression(ConditionalExpression node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitContinueStatement(ContinueStatement node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitDoLoop(DoLoop node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitElementGet(ElementGet node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitEmptyExpression(EmptyExpression node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitErrorNode(ErrorNode node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitExpressionStatement(ExpressionStatement node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitForInLoop(ForInLoop node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitForLoop(ForLoop node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitFunctionCall(FunctionCall node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitFunctionNode(FunctionNode node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitIfStatement(IfStatement node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitInfixExpression(InfixExpression node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitJump(Jump node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitKeywordLiteral(KeywordLiteral node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitLabel(Label node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitLabeledStatement(LabeledStatement node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitLetNode(LetNode node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitName(Name node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitNewExpression(NewExpression node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitNumberLiteral(NumberLiteral node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitObjectLiteral(ObjectLiteral node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitObjectProperty(ObjectProperty node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitParenthesizedExpression(ParenthesizedExpression node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitPropertyGet(PropertyGet node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitRegExpLiteral(RegExpLiteral node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitReturnStatement(ReturnStatement node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitScope(Scope node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitScriptNode(ScriptNode node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitStringLiteral(StringLiteral node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitSwitchCase(SwitchCase node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitSwitchStatement(SwitchStatement node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitSymbol(Symbol node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitThrowStatement(ThrowStatement node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitTryStatement(TryStatement node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitUnaryExpression(UnaryExpression node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitVariableDeclaration(VariableDeclaration node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitVariableInitializer(VariableInitializer node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitWhileLoop(WhileLoop node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitWithStatement(WithStatement node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitXmlDotQuery(XmlDotQuery node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitXmlElemRef(XmlElemRef node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitXmlExpression(XmlExpression node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitXmlFragment(XmlFragment node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitXmlLiteral(XmlLiteral node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitXmlMemberGet(XmlMemberGet node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitXmlPropRef(XmlPropRef node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitXmlRef(XmlRef node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitXmlString(XmlString node, A arg) ;
|
||||||
|
|
||||||
|
public abstract R visitYield(Yield node, A arg) ;
|
||||||
|
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
0
com.ibm.wala.cast.js.test/.launchConfigurations/WALA-CAst-JS-Test-Downloads.launch
Normal file → Executable file
0
com.ibm.wala.cast.js.test/.launchConfigurations/WALA-CAst-JS-Test-Downloads.launch
Normal file → Executable file
0
com.ibm.wala.cast.js.test/.launchConfigurations/com.ibm.wala.cast.js.test-JUnit.launch
Normal file → Executable file
0
com.ibm.wala.cast.js.test/.launchConfigurations/com.ibm.wala.cast.js.test-JUnit.launch
Normal file → Executable file
|
@ -0,0 +1,16 @@
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.js"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
$(document).ready(function(){
|
||||||
|
$("button").click(function(){
|
||||||
|
$(this).hide();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
<button>Click me</button>
|
||||||
|
</body>
|
||||||
|
</html>
|
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Async.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Async.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Base.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Base.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Color.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Color.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Controls.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Controls.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/DOM.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/DOM.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/DateTime.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/DateTime.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/DragAndDrop.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/DragAndDrop.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Format.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Format.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Iter.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Iter.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/LICENSE.txt
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/LICENSE.txt
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Logging.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Logging.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/LoggingPane.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/LoggingPane.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Makefile.in
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Makefile.in
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/MochiKit.js
vendored
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/MochiKit.js
vendored
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/MockDOM.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/MockDOM.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/New.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/New.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Signal.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Signal.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Sortable.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Sortable.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Style.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Style.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Test.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Test.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Visual.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/Visual.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/__package__.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/__package__.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/packed.js
Normal file → Executable file
0
com.ibm.wala.cast.js.test/examples-src/pages/mochitest/MochiKit/packed.js
Normal file → Executable file
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue