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

scalac crashes on Java inner class compiled with -parameters #10231

Closed
scabug opened this Issue Mar 16, 2017 · 3 comments

Comments

Projects
None yet
2 participants
@scabug
Copy link

scabug commented Mar 16, 2017

Outer.java

public class Outer {
    public class Inner {
    }
}

Fail.scala

object Fail {
  val o = new Outer
  val i = new o.Inner
}

Result:

$ javac -parameters Outer.java 
$ scalac -cp . Fail.scala 
error: error while loading Inner, class file './Outer$Inner.class' is broken
(class java.lang.IndexOutOfBoundsException/0)
Fail.scala:3: error: Fail.o.Inner does not have a constructor
  val i = new o.Inner
          ^
two errors found

This is a 2.12 regression, it works fine in 2.11.8. Java version is 1.8.0_121

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Mar 16, 2017

Imported From: https://issues.scala-lang.org/browse/SI-10231?orig=1
Reporter: @ghik
Affected Versions: 2.12.1

@scabug

This comment has been minimized.

Copy link
Author

scabug commented Mar 16, 2017

@ghik said:
Stack trace obtained with -Ydebug:

java.lang.IndexOutOfBoundsException: 0
        at scala.collection.LinearSeqOptimized.apply(LinearSeqOptimized.scala:63)
        at scala.collection.LinearSeqOptimized.apply$(LinearSeqOptimized.scala:61)
        at scala.collection.immutable.List.apply(List.scala:86)
        at scala.tools.nsc.symtab.classfile.ClassfileParser.readParamNames$1(ClassfileParser.scala:816)
        at scala.tools.nsc.symtab.classfile.ClassfileParser.parseAttribute$1(ClassfileParser.scala:822)
        at scala.tools.nsc.symtab.classfile.ClassfileParser.$anonfun$parseAttributes$17(ClassfileParser.scala:1039)
        at scala.tools.nsc.symtab.classfile.ClassfileParser.parseAttributes(ClassfileParser.scala:1039)
        at scala.tools.nsc.symtab.classfile.ClassfileParser.parseMethod(ClassfileParser.scala:589)
        at scala.tools.nsc.symtab.classfile.ClassfileParser.$anonfun$parseClass$4(ClassfileParser.scala:470)
        at scala.tools.nsc.symtab.classfile.ClassfileParser.queueLoad$1(ClassfileParser.scala:470)
        at scala.tools.nsc.symtab.classfile.ClassfileParser.$anonfun$parseClass$5(ClassfileParser.scala:480)
        at scala.tools.nsc.symtab.classfile.ClassfileParser.parseClass(ClassfileParser.scala:485)
        at scala.tools.nsc.symtab.classfile.ClassfileParser.$anonfun$parse$1(ClassfileParser.scala:156)
        at scala.tools.nsc.symtab.classfile.ClassfileParser.parse(ClassfileParser.scala:127)
        at scala.tools.nsc.symtab.SymbolLoaders$ClassfileLoader.doComplete(SymbolLoaders.scala:311)
        at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.complete(SymbolLoaders.scala:213)
        at scala.tools.nsc.symtab.SymbolLoaders$SymbolLoader.load(SymbolLoaders.scala:229)
        at scala.tools.nsc.typechecker.Typers$Typer.isStale(Typers.scala:515)
        at scala.tools.nsc.typechecker.Typers$Typer.reallyExists(Typers.scala:506)
        at scala.tools.nsc.typechecker.Typers$Typer.typedSelectInternal$1(Typers.scala:4848)
        at scala.tools.nsc.typechecker.Typers$Typer.typedSelect$1(Typers.scala:4812)
        at scala.tools.nsc.typechecker.Typers$Typer.typedSelectOrSuperCall$1(Typers.scala:4939)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5467)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5483)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5519)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5549)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5493)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5497)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTypeConstructor(Typers.scala:5657)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTypeConstructor(Typers.scala:5674)
        at scala.tools.nsc.typechecker.Typers$Typer.typedNew$1(Typers.scala:4458)
        at scala.tools.nsc.typechecker.Typers$Typer.typedOutsidePatternMode$1(Typers.scala:5446)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5476)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5483)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5519)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5549)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5493)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5497)
        at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:5600)
        at scala.tools.nsc.typechecker.Typers$Typer.typedQualifier(Typers.scala:5606)
        at scala.tools.nsc.typechecker.Typers$Typer.typedSelectOrSuperCall$1(Typers.scala:4932)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5467)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5483)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5519)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5549)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5493)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5497)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typed1$27(Typers.scala:4645)
        at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:703)
        at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4647)
        at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4700)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5466)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5483)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5519)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5549)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5493)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5497)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5591)
        at scala.tools.nsc.typechecker.Typers$Typer.computeType(Typers.scala:5679)
        at scala.tools.nsc.typechecker.Namers$Namer.assignTypeToTree(Namers.scala:999)
        at scala.tools.nsc.typechecker.Namers$Namer.valDefSig(Namers.scala:1545)
        at scala.tools.nsc.typechecker.Namers$Namer.memberSig(Namers.scala:1714)
        at scala.tools.nsc.typechecker.Namers$Namer.typeSig(Namers.scala:1679)
        at scala.tools.nsc.typechecker.Namers$Namer.$anonfun$valTypeCompleter$1(Namers.scala:842)
        at scala.tools.nsc.typechecker.Namers$Namer.$anonfun$valTypeCompleter$1$adapted(Namers.scala:830)
        at scala.tools.nsc.typechecker.Namers$$anon$1.completeImpl(Namers.scala:1864)
        at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter.complete(Namers.scala:1872)
        at scala.tools.nsc.typechecker.Namers$LockingTypeCompleter.complete$(Namers.scala:1870)
        at scala.tools.nsc.typechecker.Namers$$anon$1.complete(Namers.scala:1862)
        at scala.reflect.internal.Symbols$Symbol.info(Symbols.scala:1512)
        at scala.reflect.internal.Symbols$Symbol.initialize(Symbols.scala:1660)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5125)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5519)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5549)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5493)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5497)
        at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5580)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:3062)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$9(Typers.scala:3206)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3206)
        at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1974)
        at scala.tools.nsc.typechecker.Typers$Typer.typedModuleDef(Typers.scala:1845)
        at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5433)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5482)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5519)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5549)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5493)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5497)
        at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5580)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStat$1(Typers.scala:3062)
        at scala.tools.nsc.typechecker.Typers$Typer.$anonfun$typedStats$9(Typers.scala:3206)
        at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3206)
        at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:5132)
        at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5435)
        at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5482)
        at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5519)
        at scala.tools.nsc.typechecker.Typers$Typer.typedInternal(Typers.scala:5549)
        at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5493)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5497)
        at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5576)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:102)
        at scala.tools.nsc.Global$GlobalPhase.$anonfun$applyPhase$1(Global.scala:416)
        at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:409)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.$anonfun$run$1(Analyzer.scala:94)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.$anonfun$run$1$adapted(Analyzer.scala:93)
        at scala.collection.Iterator.foreach(Iterator.scala:929)
        at scala.collection.Iterator.foreach$(Iterator.scala:929)
        at scala.collection.AbstractIterator.foreach(Iterator.scala:1406)
        at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:93)
        at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1418)
        at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1403)
        at scala.tools.nsc.Global$Run.compileSources(Global.scala:1398)
        at scala.tools.nsc.Global$Run.compile(Global.scala:1492)
        at scala.tools.nsc.MainClass.doCompile(Main.scala:24)
        at scala.tools.nsc.Driver.process(Driver.scala:55)
        at scala.tools.nsc.Driver.main(Driver.scala:68)
        at scala.tools.nsc.Main.main(Main.scala)
@scabug

This comment has been minimized.

Copy link
Author

scabug commented Mar 17, 2017

@scabug scabug closed this Mar 22, 2017

@scabug scabug added this to the 2.12.2 milestone Apr 7, 2017

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