albertogoffi / toradocu

Toradocu - automated generation of test oracles from Javadoc documentation
Other
42 stars 21 forks source link

Reflection issue when applied to com.google.common.base.SmallCharMatcher from Guava #79

Closed bjkeller closed 7 years ago

bjkeller commented 7 years ago

Using Guava clone (https://github.com/randoop/guava) to generate conditions for com.google.common.base.SmallCharMatcher get the following error

[main] ERROR org.toradocu.util.Reflection - Unable to load class com.google.common.base.CharMatcher.NamedFastMatcher. Check the classpath.
Exception in thread "main" java.lang.NullPointerException
        at org.toradocu.extractor.DocumentedMethod.getExecutable(DocumentedMethod.java:263)
        at org.toradocu.Toradocu.convertConditionsToJava(Toradocu.java:305)
        at org.toradocu.Toradocu.main(Toradocu.java:243)

The classpath is the Guava build script generate jar file, so it should be OK.

The input class is declared as

final class SmallCharMatcher extends NamedFastMatcher

Perhaps the issue is that com.google.common.base.CharMatcher.NamedFastMatcher is package private.

bjkeller commented 7 years ago

Identical issue for visiting com.google.common.collect.HashBiMap inheriting from com.google.common.collect.Maps.IteratorBasedAbstractMap

albertogoffi commented 7 years ago

I'm not able to reproduce the error.

I tried with the Guava official releases 19 and 21, and I tried with your Guava clone: In every case Toradocu produced the output in JSON format. Can you tell me the command line options you used?

albertogoffi commented 7 years ago

Bug confirmed when the option --export-conditions is used.

The problem is due to a mismatch between the class name we collect from the source code using Javadoc APIs and the binary name required to load the class through reflection APIs.