Skip to content

Issue mapping method in AIC from Eclipse to WALA #281

@khatchad

Description

@khatchad

I am unable to use com.ibm.wala.cast.java.translator.jdt.JDTIdentityMapper.getMethodRef(IMethodBinding) to look up a method declared in an AIC. Here's an input example that causes this error:

class A {
    void m() {
    }
    
	pubic static void main(String[] args) {
		new A() {
			@Override
			void m() {
				new ArrayList().stream().count();
			}
		};
	}
}

The input method is the m() declaration inside the AIC. Here's the client code:

MethodDeclaration mDecl = // ...
JDTIdentityMapper mapper = getJDTIdentifyMapper(mDecl);
MethodReference methodRef = mapper.getMethodRef(mDecl.resolveBinding());

And stack trace from a test I ran:

-- Error Log from JUnit --
Method: testAnonymousInnerClass
Actual: null
Expected: null
Stack Trace:
java.lang.NullPointerException
	at com.ibm.wala.cast.java.translator.jdt.JDT2CAstUtils.anonTypeName(JDT2CAstUtils.java:231)
	at com.ibm.wala.cast.java.translator.jdt.JDTIdentityMapper.anonLocalTypeToTypeID(JDTIdentityMapper.java:134)
	at com.ibm.wala.cast.java.translator.jdt.JDTIdentityMapper.typeToTypeID(JDTIdentityMapper.java:113)
	at com.ibm.wala.cast.java.translator.jdt.JDTIdentityMapper.getMethodRef(JDTIdentityMapper.java:182)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions