Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Default package causes problems #105

Closed
JakeWharton opened this issue Jul 26, 2016 · 2 comments
Closed

Default package causes problems #105

JakeWharton opened this issue Jul 26, 2016 · 2 comments

Comments

@JakeWharton
Copy link
Contributor

JakeWharton commented Jul 26, 2016

java.lang.RuntimeException: Failed to backport class: Example
    at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:128)
    at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:107)
    at net.orfjackal.retrolambda.Transformers.backportClass(Transformers.java:47)
    at net.orfjackal.retrolambda.Retrolambda.run(Retrolambda.java:77)
    at net.orfjackal.retrolambda.Main.main(Main.java:26)
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.String.substring(String.java:1955)
    at net.orfjackal.retrolambda.lambdas.BackportLambdaInvocations.isNonOwnedMethodVisible(BackportLambdaInvocations.java:107)
    at net.orfjackal.retrolambda.lambdas.BackportLambdaInvocations.getLambdaAccessMethod(BackportLambdaInvocations.java:66)
    at net.orfjackal.retrolambda.lambdas.BackportLambdaInvocations$InvokeDynamicInsnConverter.backportLambda(BackportLambdaInvocations.java:169)
    at net.orfjackal.retrolambda.lambdas.BackportLambdaInvocations$InvokeDynamicInsnConverter.visitInvokeDynamicInsn(BackportLambdaInvocations.java:160)
    at net.orfjackal.retrolambda.asm.ClassReader.readCode(ClassReader.java:1452)
    at net.orfjackal.retrolambda.asm.ClassReader.readMethod(ClassReader.java:1017)
    at net.orfjackal.retrolambda.asm.ClassReader.accept(ClassReader.java:693)
    at net.orfjackal.retrolambda.asm.ClassReader.accept(ClassReader.java:506)
    at net.orfjackal.retrolambda.Transformers.lambda$transform$5(Transformers.java:107)
    at net.orfjackal.retrolambda.Transformers$$Lambda$8/1530388690.accept(Unknown Source)
    at net.orfjackal.retrolambda.Transformers.transform(Transformers.java:124)
    ... 4 more

Pretty sure this is my fault! We should be checking for -1 from indexOf before calling substring. Unlikely to be hit in production because no one should be using the default package! I found it while working on content for a presentation.

I'll send a fix later this week or next if someone doesn't beat me to it.

@csoroiu
Copy link
Contributor

csoroiu commented Nov 1, 2016

I stepped into this today while performing a build using retrolambda maven plugin v2.3.0.

@luontola
Copy link
Owner

This has been included in Retrolambda 2.4.0. Sorry about taking so long to merge.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants