Bug in project when importing "Reflections" from Mirah #197

Closed
kaspernj opened this Issue Dec 28, 2012 · 6 comments

Comments

Projects
None yet
2 participants

When trying to import the Reflections lib in a Mirah file, I get the following bug. It works fine with a Java-version of the same class.

I have created a branch with the bug here (Maven project):
https://github.com/kaspernj/mirah_stdlib_core/tree/reflections_bug

The commands used to reproduce:
mvn clean
mvn test

Message:

Parsing...
./stop_iteration.mirah
./enumerator.mirah
./enumerator_yielder.mirah
./mirah_tester.mirah
Inferring types...
Inference Error:
undefined method visitParameterAnnotation' for #<BiteScript::ASM::ClassMirror::Builder:0x308e44de> ./mirah_tester.mirah:7: undefined methodvisitParameterAnnotation' for #BiteScript::ASM::ClassMirror::Builder:0x308e44de
import org.reflections.Reflections
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [mirah:testCompile {execution: default}]

Owner

baroquebobcat commented Jan 7, 2013

Hmm. Looks like there's a missing method in bitescript, which is the library we use to generate our bytecode. Do you think you could put together a reduced testcase?

kaspernj commented Jan 7, 2013

Here is a minimal project containing only a test that reproduces the bug:
https://github.com/kaspernj/reflectionsbug/blob/master/src/test/mirah/TestReflectionsBug.mirah

I run:
mvn clean
mvn test

And get the following:
...
Parsing...
/home/kaspernj/Dev/Java/Eclipse/reflectionsbug/src/test/mirah/TestReflectionsBug.mirah
Inferring types...
Inference Error:
undefined method visitParameterAnnotation' for #<BiteScript::ASM::ClassMirror::Builder:0x141135b5> /home/kaspernj/Dev/Java/Eclipse/reflectionsbug/src/test/mirah/TestReflectionsBug.mirah:2: undefined methodvisitParameterAnnotation' for #BiteScript::ASM::ClassMirror::Builder:0x141135b5
import org.reflections.Reflections
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[INFO] [resources:testResources {execution: default-testResources}]
...

Owner

baroquebobcat commented Jan 13, 2013

Ah ha! The first problem is that the ASM MethodVisitor that bitescript has is missing visitParameterAnnotation. I pushed a patch that defines the method. It ignores the annotations for now.

Now I'm getting an InferenceError with no explanation, but looking at the method definition, I see what the problem is: it uses varargs and I haven't gotten varargs support in yet.

http://code.google.com/p/reflections/source/browse/trunk/reflections/src/main/java/org/reflections/Reflections.java#107

Owner

baroquebobcat commented Feb 4, 2013

This should be fixed on master c1886fc

kaspernj commented Feb 4, 2013

Sounds great! Thank you for looking into this!

Owner

baroquebobcat commented Feb 11, 2013

I'm closing this. Reopen it if it's still an issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment