Skip to content
Commits on Source (6)
com.ibm.wala
\ No newline at end of file
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="999" />
</JavaCodeStyleSettings>
</code_scheme>
</component>
\ No newline at end of file
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
</project>
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="FrameworkDetectionExcludesConfiguration">
<type id="Osmorc" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="false" project-jdk-name="Java 1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
......
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CommitMessageInspectionProfile">
<profile version="1.0">
<inspection_tool class="BodyLimit" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SubjectBodySeparation" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SubjectLimit" enabled="true" level="WARNING" enabled_by_default="true">
<option name="RIGHT_MARGIN" value="50" />
</inspection_tool>
</profile>
</component>
<component name="VcsDirectoryMappings">
<mapping directory="" vcs="Git" />
</component>
......
sudo: false
android:
components:
- build-tools-26.0.2
......
......@@ -4,11 +4,12 @@
//
plugins {
id 'com.diffplug.gradle.p2.asmaven' version '3.10.0'
id 'com.diffplug.gradle.p2.asmaven' version '3.17.0'
id 'com.github.hauner.jarTest' version '1.0.1' apply false
id 'de.undercouch.download'
id 'nebula.lint' version '8.3.1'
id 'nebula.source-jar' version '7.0.1' apply false
id 'maven-publish'
}
......@@ -52,7 +53,7 @@ p2AsMaven {
//
group name
version '1.5.0'
version '1.5.1'
subprojects { subproject ->
// skip generic Java setup for the few projects that have no Java code whatsoever
......@@ -161,7 +162,8 @@ allprojects {
allprojects {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
options.addBooleanOption('Xdoclint:all,-missing', true)
options.quiet()
}
}
......
......@@ -5,7 +5,7 @@
<parent>
<groupId>com.ibm.wala</groupId>
<artifactId>WALA</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<artifactId>com.ibm.wala-repository</artifactId>
<packaging>eclipse-repository</packaging>
......
......@@ -9,16 +9,22 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul
org.eclipse.jdt.core.compiler.annotation.nullable.secondary=
org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.APILeak=warning
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=error
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=error
org.eclipse.jdt.core.compiler.problem.comparingIdentical=error
org.eclipse.jdt.core.compiler.problem.deadCode=error
org.eclipse.jdt.core.compiler.problem.deprecation=ignore
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=disabled
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
......@@ -42,7 +48,7 @@ org.eclipse.jdt.core.compiler.problem.missingEnumCaseDespiteDefault=disabled
org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=error
org.eclipse.jdt.core.compiler.problem.missingJavadocComments=ignore
org.eclipse.jdt.core.compiler.problem.missingJavadocCommentsVisibility=public
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=no_tag
org.eclipse.jdt.core.compiler.problem.missingJavadocTagDescription=all_standard_tags
org.eclipse.jdt.core.compiler.problem.missingJavadocTags=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=ignore
org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
......@@ -62,7 +68,7 @@ org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.pessimisticNullAnalysisForFreeTypeVariables=error
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=error
org.eclipse.jdt.core.compiler.problem.potentialNullReference=error
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=error
org.eclipse.jdt.core.compiler.problem.potentiallyUnclosedCloseable=warning
org.eclipse.jdt.core.compiler.problem.rawTypeReference=error
org.eclipse.jdt.core.compiler.problem.redundantNullAnnotation=error
org.eclipse.jdt.core.compiler.problem.redundantNullCheck=error
......@@ -76,6 +82,7 @@ org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntacticNullAnalysisForFields=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.terminalDeprecation=warning
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=error
org.eclipse.jdt.core.compiler.problem.unavoidableGenericTypeProblems=disabled
org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=error
......@@ -103,6 +110,6 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=di
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=error
org.eclipse.jdt.core.compiler.problem.unusedWarningToken=ignore
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=error
org.eclipse.jdt.core.compiler.source=1.8
......@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %Bundle-Name
Bundle-SymbolicName: com.ibm.wala.cast.java.ecj
Bundle-Version: 1.5.0
Bundle-Version: 1.5.1
Bundle-Vendor: %Bundle-Vendor
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Require-Bundle: com.ibm.wala.cast.java,
......
......@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.cast.java.ecj</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
<packaging>jar</packaging>
<name>WALA CAst Java ECJ</name>
<description>WALA Common AST Java ECJ front-end</description>
......@@ -45,27 +45,27 @@
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.util</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.cast</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.cast.java</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.core</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>com.ibm.wala</groupId>
<artifactId>com.ibm.wala.shrike</artifactId>
<version>1.5.0</version>
<version>1.5.1</version>
</dependency>
<dependency>
<groupId>org.eclipse.core</groupId>
......
......@@ -5,7 +5,7 @@
<parent>
<artifactId>WALA</artifactId>
<groupId>com.ibm.wala</groupId>
<version>1.5.0</version>
<version>1.5.1</version>
</parent>
<artifactId>com.ibm.wala.cast.java.ecj</artifactId>
<packaging>eclipse-plugin</packaging>
......
......@@ -134,6 +134,7 @@ public class FakeExceptionTypeBinding implements ITypeBinding {
return null;
}
@SuppressWarnings("deprecation")
@Override
public int getDeclaredModifiers() {
Assertions.UNREACHABLE("FakeExceptionTypeBinding ");
......
......@@ -172,8 +172,6 @@ public class JDT2CAstUtils {
/**
* Returns true if type is char, byte, short, int, or long. Return false otherwise (including boolean!)
*
* @param type
*/
public static boolean isLongOrLess(ITypeBinding type) {
String t = type.getBinaryName();
......@@ -183,8 +181,6 @@ public class JDT2CAstUtils {
/**
* If isLongOrLess(type), returns Integer(0). If a float or double, returns Double(0.0) Otherwise (including boolean), returns
* CAstSymbol.NULL_DEFAULT_VALUE.
*
* @param type
*/
public static Object defaultValueForType(ITypeBinding type) {
if (isLongOrLess(type))
......@@ -227,14 +223,11 @@ public class JDT2CAstUtils {
static String anonTypeName(ITypeBinding ct) {
String binName = ct.getBinaryName();
String dollarSignNumber = binName.substring(binName.indexOf('$'));
return "<anonymous subclass of " + ct.getSuperclass().getBinaryName() + ">" + dollarSignNumber;
return "<anonymous subclass of " + ct.getSuperclass().getBinaryName() + '>' + dollarSignNumber;
}
/**
* If a type variable, return the bound (getTypeVariablesBase()). If a parameterized type, return the generic type.
*
* @param returnType
* @param ast
*/
public static ITypeBinding getErasedType(ITypeBinding returnType, AST ast) {
if (returnType.isTypeVariable() || returnType.isCapture())
......
......@@ -289,8 +289,11 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
private final T fSourcePosition;
private final T fNamePos;
public ClassEntity(ITypeBinding jdtType, String name, Collection<CAstQualifier> quals, Collection<CAstEntity> entities,
T pos) {
T pos, T namePos) {
fNamePos = namePos;
fName = name;
fQuals = quals;
fEntities = entities;
......@@ -317,7 +320,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
@Override
public String getSignature() {
return "L" + fName.replace('.', '/') + ";";
return 'L' + fName.replace('.', '/') + ';';
}
@Override
......@@ -396,6 +399,11 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
return fTypeDict.new JdtJavaType(fJdtType);
}
@Override
public Position getNamePosition() {
return fNamePos;
}
}
private static boolean isInterface(AbstractTypeDeclaration decl) {
......@@ -405,21 +413,15 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
private CAstEntity visitTypeDecl(AbstractTypeDeclaration n, WalkContext context) {
return createClassDeclaration(n, n.bodyDeclarations(), null, n.resolveBinding(), n.getName().getIdentifier(), n.getModifiers(),
isInterface(n), n instanceof AnnotationTypeDeclaration, context);
isInterface(n), n instanceof AnnotationTypeDeclaration, context, makePosition(n.getName()));
}
/**
*
* @param n
* @param bodyDecls
* @param enumConstants
* @param typeBinding
* @param name Used in creating default constructor, and passed into new ClassEntity()
* @param context
*/
private CAstEntity createClassDeclaration(ASTNode n, List<BodyDeclaration> bodyDecls,
List<EnumConstantDeclaration> enumConstants, ITypeBinding typeBinding, String name, int modifiers,
boolean isInterface, boolean isAnnotation, WalkContext context) {
boolean isInterface, boolean isAnnotation, WalkContext context, T namePos) {
final List<CAstEntity> memberEntities = new ArrayList<>();
// find and collect all initializers (type Initializer) and field initializers (type VariableDeclarationFragment).
......@@ -453,7 +455,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
// process entities. initializers will be folded in here.
if (enumConstants != null) {
for (EnumConstantDeclaration decl : enumConstants) {
memberEntities.add(visit(decl, context));
memberEntities.add(visit(decl));
}
}
......@@ -465,7 +467,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
IVariableBinding fieldBinding = fieldFrag.resolveBinding();
memberEntities.add(new FieldEntity(fieldFrag.getName().getIdentifier(), fieldBinding.getType(), quals,
makePosition(fieldFrag.getStartPosition(), fieldFrag.getStartPosition() + fieldFrag.getLength()),
handleAnnotations(fieldBinding)));
handleAnnotations(fieldBinding), makePosition(fieldFrag.getName())));
}
} else if (decl instanceof Initializer) {
// Initializers are inserted into constructors when making constructors.
......@@ -526,12 +528,12 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
Collection<CAstQualifier> quals = JDT2CAstUtils.mapModifiersToQualifiers(modifiers, isInterface, isAnnotation);
return new ClassEntity(typeBinding, name, quals, memberEntities, makePosition(n));
return new ClassEntity(typeBinding, name, quals, memberEntities, makePosition(n), namePos);
}
private CAstEntity visit(AnonymousClassDeclaration n, WalkContext context) {
return createClassDeclaration(n, n.bodyDeclarations(), null, n.resolveBinding(),
JDT2CAstUtils.anonTypeName(n.resolveBinding()), 0 /* no modifiers */, false, false, context);
JDT2CAstUtils.anonTypeName(n.resolveBinding()), 0 /* no modifiers */, false, false, context, null);
}
private CAstNode visit(TypeDeclarationStatement n, WalkContext context) {
......@@ -648,11 +650,8 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
* Setup constructor body. Here we add the initializer code (both initalizer blocks and initializers in field declarations). We
* may also need to add an implicit super() call.
*
* @param n
* @param classBinding Used so we can use this with fake MethodDeclaration nodes, as in the case of creating a default
* constructor.
* @param context
* @param inits
*/
private CAstNode createConstructorBody(MethodDeclaration n, ITypeBinding classBinding, WalkContext context,
ArrayList<ASTNode> inits) {
......@@ -723,7 +722,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
*
* @param overriding Declaration of the overriding method.
* @param overridden Binding of the overridden method, in a a superclass or implemented interface.
* @param oldContext
*/
private CAstEntity makeSyntheticCovariantRedirect(MethodDeclaration overriding, IMethodBinding overridingBinding,
IMethodBinding overridden, WalkContext oldContext) {
......@@ -917,8 +915,8 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
// from CodeBodyEntity
fEntities = new LinkedHashMap<>();
for (CAstNode key : entities.keySet()) {
fEntities.put(key, Collections.singleton(entities.get(key)));
for (Map.Entry<CAstNode, CAstEntity> entry : entities.entrySet()) {
fEntities.put(entry.getKey(), Collections.singleton(entry.getValue()));
}
if (fDecl != null) {
......@@ -1046,7 +1044,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
public CAstType getReturnType() {
if (fReturnType != null)
return fTypeDict.getCAstTypeFor(fReturnType);
Type type = fDecl == null ? null : (ast.apiLevel() == 2 ? fDecl.getReturnType() : fDecl.getReturnType2());
@SuppressWarnings("deprecation") Type type = fDecl == null ? null : (ast.apiLevel() == 2 ? fDecl.getReturnType() : fDecl.getReturnType2());
if (type == null)
return fTypeDict.getCAstTypeFor(ast.resolveWellKnownType("void"));
else
......@@ -1106,6 +1104,15 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
SingleVariableDeclaration p = (SingleVariableDeclaration) fDecl.parameters().get(arg);
return makePosition(p);
}
@Override
public Position getNamePosition() {
if (fDecl == null) {
return null;
} else {
return makePosition(fDecl);
}
}
}
// ////////////////////////////////////
......@@ -1158,13 +1165,16 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
private final T position;
private final T namePos;
private final Set<CAstAnnotation> annotations;
private FieldEntity(String name, ITypeBinding type, Collection<CAstQualifier> quals, T position, Set<CAstAnnotation> annotations) {
private FieldEntity(String name, ITypeBinding type, Collection<CAstQualifier> quals, T position, Set<CAstAnnotation> annotations, T namePos) {
super();
this.type = type;
this.quals = quals;
this.name = name;
this.namePos = namePos;
this.position = position;
this.annotations = annotations;
}
......@@ -1261,6 +1271,13 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
@Override
public Position getPosition(int arg) {
return namePos;
}
@Override
public Position getNamePosition() {
// TODO Auto-generated method stub
return null;
}
}
......@@ -1282,7 +1299,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
private CAstNode visit(Block n, WalkContext context) {
ArrayList<CAstNode> stmtNodes = createBlock(n, context);
CAstNode stmtNodesArray[] = stmtNodes.toArray(new CAstNode[stmtNodes.size()]);
CAstNode stmtNodesArray[] = stmtNodes.toArray(new CAstNode[0]);
return makeNode(context, fFactory, n, CAstNode.LOCAL_SCOPE, makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, stmtNodesArray));
}
......@@ -1444,11 +1461,8 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
}
/**
*
* @param met
* @param mappedAstNode An AST node or object mapped in the CFG: we will call context.cfg().add() on it. Caller must worry about
* mapping it with context.cfg().map().
* @param context
*/
private void handleThrowsFromCall(IMethodBinding met, Object mappedAstNode, WalkContext context) {
ITypeBinding[] throwTypes = met.getExceptionTypes();
......@@ -1589,11 +1603,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
* If the number of actuals equals the number of formals and the function is varargs, we have to check the type of the last
* argument to see if we should "box" it in an array. If the arguments[arguments.length-1] is not an Expression, we cannot get the
* type, so we do not box it. (Making covariant varargs functions require this behavior)
*
* @param children
* @param methodBinding
* @param arguments
* @param context
*/
private void populateArguments(CAstNode[] children, IMethodBinding methodBinding, List<?/* CAstNode or Expression */> arguments,
WalkContext context) {
......@@ -1684,8 +1693,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
*
* where field 'y' is parameterized to type string. then += is not defined for type 'object'. This function is a hack that expands
* the code into an assignment and binary operation.
*
* @param context
*/
private CAstNode doFunkyGenericAssignPreOpHack(Assignment assign, WalkContext context) {
Expression left = assign.getLeftHandSide();
......@@ -1768,9 +1775,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
/**
* SimpleName can be a field access, local, or class name (do nothing case)
*
* @param n
* @param context
*/
private CAstNode visit(SimpleName n, WalkContext context) {
// class name, handled above in either method invocation, qualified name, or qualified this
......@@ -1834,9 +1838,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
*
* Essentially if we have a field/method referenced only by name and we know its type (owningTypeRef), this function will return
* owningTypeRef or the subtype that the field is accessed thru, for expanding "f = 5" into "TheClass.this.f = 5".
*
* @param typeOfThis
* @param isPrivate
*/
private static ITypeBinding findClosestEnclosingClassSubclassOf(ITypeBinding typeOfThis, ITypeBinding owningType, boolean isPrivate) {
// GENERICS
......@@ -1881,9 +1882,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
/**
* Process a field access. Semantics differ for static and instance fields. Fields can throw null pointer exceptions so we must
* connect proper exceptional edges in the CFG.
*
* @param n
* @param context
*/
private CAstNode visit(FieldAccess n, WalkContext context) {
CAstNode targetNode = visitNode(n.getExpression(), context);
......@@ -1899,7 +1897,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
* block -- thus it is evaluated for any side effects but thrown away.
* @param fieldName Name of the field.
* @param positioningNode Used only for making a JdtPosition.
* @param context
*/
private CAstNode createFieldAccess(CAstNode targetNode, String fieldName, IVariableBinding possiblyParameterizedBinding,
ASTNode positioningNode, WalkContext context) {
......@@ -1991,9 +1988,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
* a) field access (QualifiedName) b) method invocation c) qualifier of "this" in these cases we get the binding info in each of
* these three functions and use them there, thus we return an EMPTY (no-op) here. 3) package names used in the context of a
* QualifiedName class we return a EMPTY (no-op) here.
*
* @param n
* @param context
*/
private CAstNode visit(QualifiedName n, WalkContext context) {
// "package.Class" is a QualifiedName, but also is "Class.staticField"
......@@ -2397,7 +2391,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
if (s instanceof SwitchCase) {
if (!currentBlock.isEmpty()) {
// bundle up statements before this case
CAstNode stmtNodes[] = currentBlock.toArray(new CAstNode[currentBlock.size()]);
CAstNode stmtNodes[] = currentBlock.toArray(new CAstNode[0]);
// make position from start of first statement to end of last statement
T positionOfAll = makePosition(childContext.pos().getPosition(stmtNodes[0]).getFirstOffset(), childContext
.pos().getPosition(stmtNodes[stmtNodes.length - 1]).getLastOffset());
......@@ -2411,7 +2405,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
}
if (!currentBlock.isEmpty()) {
// bundle up statements before this case
CAstNode stmtNodes[] = currentBlock.toArray(new CAstNode[currentBlock.size()]);
CAstNode stmtNodes[] = currentBlock.toArray(new CAstNode[0]);
// make position from start of first statement to end of last statement
T positionOfAll = makePosition(childContext.pos().getPosition(stmtNodes[0]).getFirstOffset(), childContext.pos()
.getPosition(stmtNodes[stmtNodes.length - 1]).getLastOffset());
......@@ -2420,7 +2414,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
// Now produce the switch stmt itself
CAstNode switchAst = makeNode(context, fFactory, n, CAstNode.SWITCH, visitNode(cond, context), makeNode(context, fFactory, n,
CAstNode.BLOCK_STMT, caseNodes.toArray(new CAstNode[caseNodes.size()])));
CAstNode.BLOCK_STMT, caseNodes.toArray(new CAstNode[0])));
context.cfg().map(n, switchAst);
......@@ -2455,9 +2449,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
* iterable.iter(); iter.hasNext(); ) { [final] Type var = (Type) iter.next(); ... } Or, in the case of an array: for ( int idx =
* 0; i &lt; iterable.length; i++ ) { [final] Type var = iterable[idx]; ... } Except that the expression "iterable" is only evaluate
* once (or is it?)
*
* @param n
* @param context
*/
private CAstNode visit(EnhancedForStatement n, WalkContext context) {
if (n.getExpression().resolveTypeBinding().isArray())
......@@ -2648,7 +2639,7 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
for (int i = 0; i < iters.length; i++)
iters[i] = visitNode((ASTNode) n.updaters().get(i), context);
CAstNode initsBlock = makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, inits.toArray(new CAstNode[inits.size()]));
CAstNode initsBlock = makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, inits.toArray(new CAstNode[0]));
CAstNode itersBlock = makeNode(context, fFactory, n, CAstNode.BLOCK_STMT, iters);
// { [inits]; while (cond) { [body]; [label continueTarget]; iters } [label breakTarget]
......@@ -2803,8 +2794,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
/**
* Giant switch statement.
*
* @param n
*/
private CAstEntity visit(AbstractTypeDeclaration n, WalkContext context) {
// handling of compilationunit in translate()
......@@ -2822,8 +2811,6 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
/**
* Giant switch statement, part deux
*
* @param context
*/
private CAstNode visitNode(ASTNode n, WalkContext context) {
if (n == null)
......@@ -3045,6 +3032,11 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
public Position getPosition(int arg) {
return null;
}
@Override
public Position getNamePosition() {
return null;
}
}
// /////////////////////////////
......@@ -3334,13 +3326,10 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
/**
* Only called from createClassDeclaration.
*
* @param decl
* @param context
*/
private CAstEntity visit(EnumConstantDeclaration decl, WalkContext context) {
private CAstEntity visit(EnumConstantDeclaration decl) {
return new FieldEntity(decl.getName().getIdentifier(), decl.resolveVariable().getType(), enumQuals, makePosition(decl
.getStartPosition(), decl.getStartPosition() + decl.getLength()), null);
.getStartPosition(), decl.getStartPosition() + decl.getLength()), null, makePosition(decl.getName()));
}
/**
......@@ -3489,10 +3478,9 @@ public abstract class JDTJava2CAstTranslator<T extends Position> {
}
private CAstEntity visit(EnumDeclaration n, WalkContext context) {
// JDT contains correct type info / class / subclass info for the enum
return createClassDeclaration(n, n.bodyDeclarations(), n.enumConstants(), n.resolveBinding(), n.getName().getIdentifier(), n
.resolveBinding().getModifiers(), false, false, context);
.resolveBinding().getModifiers(), false, false, context, makePosition(n.getName()));
}
/**
......
......@@ -116,7 +116,7 @@ public class JDTTypeDictionary extends CAstTypeDictionaryImpl<ITypeBinding> {
@Override
public String getName() {
return "[" + fEltCAstType.getName();
return '[' + fEltCAstType.getName();
}
@Override
......@@ -144,7 +144,7 @@ public class JDTTypeDictionary extends CAstTypeDictionaryImpl<ITypeBinding> {
@Override
public String toString() {
return super.toString() + ":" + getName();
return super.toString() + ':' + getName();
}
public JdtJavaType(ITypeBinding type) {
......