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

Scala compiler crash when using scala.swing.ComboBox.peer.setModel() #8745

Closed
scabug opened this issue Jul 23, 2014 · 6 comments
Closed

Scala compiler crash when using scala.swing.ComboBox.peer.setModel() #8745

scabug opened this issue Jul 23, 2014 · 6 comments

Comments

@scabug
Copy link

scabug commented Jul 23, 2014

Compiling a small Swing application which uses scala.swing.ComboBox.peer.setModel() causes the compiler to crash with [error] (visualization/compile:compile) java.lang.IndexOutOfBoundsException: 0.

If the line containing peer.setModel() is removed, the code compiles fine.

Code snippet to reproduce:

package test

import scala.swing._
import scala.swing.event._

class DdgVisualizer extends GridBagPanel  {
  var comboBoxItems = List[Int]()
  val selector = new ComboBox(comboBoxItems)

  def addResult(result: Int) {
    comboBoxItems = result :: comboBoxItems
    selector.peer.setModel(ComboBox.newConstantModel(comboBoxItems))
  }
}

Commands to reproduce in Scala shell:

import swing.ComboBox
val comboBox = new ComboBox(1 to 10)
comboBox.peer.setModel(ComboBox.newConstantModel(1 to 20))

Full stack trace:

java.lang.IndexOutOfBoundsException: 0
	at scala.collection.LinearSeqOptimized$class.apply(LinearSeqOptimized.scala:51)
	at scala.collection.immutable.List.apply(List.scala:83)
	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.correspondingTypeArgument(TypeMaps.scala:551)
	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.loop$3(TypeMaps.scala:585)
	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.classParameterAsSeen(TypeMaps.scala:590)
	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.apply(TypeMaps.scala:467)
	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.apply(TypeMaps.scala:441)
	at scala.collection.immutable.List.loop$1(List.scala:172)
	at scala.collection.immutable.List.mapConserve(List.scala:188)
	at scala.reflect.internal.tpe.TypeMaps$TypeMap.mapOver(TypeMaps.scala:115)
	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.apply(TypeMaps.scala:468)
	at scala.reflect.internal.tpe.TypeMaps$TypeMap.applyToSymbolInfo(TypeMaps.scala:218)
	at scala.reflect.internal.tpe.TypeMaps$TypeMap.loop$1(TypeMaps.scala:227)
	at scala.reflect.internal.tpe.TypeMaps$TypeMap.noChangeToSymbols(TypeMaps.scala:229)
	at scala.reflect.internal.tpe.TypeMaps$TypeMap.mapOver(TypeMaps.scala:243)
	at scala.reflect.internal.tpe.TypeMaps$TypeMap.mapOver(TypeMaps.scala:128)
	at scala.reflect.internal.tpe.TypeMaps$AsSeenFromMap.apply(TypeMaps.scala:468)
	at scala.reflect.internal.Types$Type.asSeenFrom(Types.scala:663)
	at scala.reflect.internal.Types$Type.computeMemberType(Types.scala:698)
	at scala.reflect.internal.Symbols$MethodSymbol.typeAsMemberOf(Symbols.scala:2857)
	at scala.reflect.internal.Types$Type.memberType(Types.scala:689)
	at scala.tools.nsc.typechecker.Infer$Inferencer.checkAccessible(Infer.scala:274)
	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$makeAccessible(Typers.scala:581)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$100.apply(Typers.scala:4671)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$100.apply(Typers.scala:4671)
	at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:710)
	at scala.tools.nsc.typechecker.Typers$Typer.typedSelectInternal$1(Typers.scala:4671)
	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedSelect$1(Typers.scala:4596)
	at scala.tools.nsc.typechecker.Typers$Typer.typedSelectOrSuperCall$1(Typers.scala:4735)
	at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5253)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5269)
	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5305)
	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5332)
	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5279)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5283)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$93.apply(Typers.scala:4440)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$93.apply(Typers.scala:4440)
	at scala.tools.nsc.typechecker.Typers$Typer.silent(Typers.scala:696)
	at scala.tools.nsc.typechecker.Typers$Typer.normalTypedApply$1(Typers.scala:4439)
	at scala.tools.nsc.typechecker.Typers$Typer.typedApply$1(Typers.scala:4494)
	at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5252)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5269)
	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5305)
	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5332)
	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5279)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5283)
	at scala.tools.nsc.typechecker.Typers$Typer.typedBlock(Typers.scala:2364)
	at scala.tools.nsc.typechecker.Typers$Typer.typedOutsidePatternMode$1(Typers.scala:5226)
	at scala.tools.nsc.typechecker.Typers$Typer.typedInAnyMode$1(Typers.scala:5262)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5269)
	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5305)
	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5332)
	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5279)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5283)
	at scala.tools.nsc.typechecker.Typers$Typer.transformedOrTyped(Typers.scala:5514)
	at scala.tools.nsc.typechecker.Typers$Typer.typedDefDef(Typers.scala:2192)
	at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5217)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5268)
	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5305)
	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5332)
	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5279)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5283)
	at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5361)
	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:3000)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$62.apply(Typers.scala:3104)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$62.apply(Typers.scala:3104)
	at scala.collection.immutable.List.loop$1(List.scala:172)
	at scala.collection.immutable.List.mapConserve(List.scala:188)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3104)
	at scala.tools.nsc.typechecker.Typers$Typer.typedTemplate(Typers.scala:1907)
	at scala.tools.nsc.typechecker.Typers$Typer.typedClassDef(Typers.scala:1753)
	at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5218)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5268)
	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5305)
	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5332)
	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5279)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5283)
	at scala.tools.nsc.typechecker.Typers$Typer.typedByValueExpr(Typers.scala:5361)
	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedStat$1(Typers.scala:3000)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$62.apply(Typers.scala:3104)
	at scala.tools.nsc.typechecker.Typers$Typer$$anonfun$62.apply(Typers.scala:3104)
	at scala.collection.immutable.List.loop$1(List.scala:172)
	at scala.collection.immutable.List.mapConserve(List.scala:188)
	at scala.tools.nsc.typechecker.Typers$Typer.typedStats(Typers.scala:3104)
	at scala.tools.nsc.typechecker.Typers$Typer.typedPackageDef$1(Typers.scala:4928)
	at scala.tools.nsc.typechecker.Typers$Typer.typedMemberDef$1(Typers.scala:5221)
	at scala.tools.nsc.typechecker.Typers$Typer.typed1(Typers.scala:5268)
	at scala.tools.nsc.typechecker.Typers$Typer.runTyper$1(Typers.scala:5305)
	at scala.tools.nsc.typechecker.Typers$Typer.scala$tools$nsc$typechecker$Typers$Typer$$typedInternal(Typers.scala:5332)
	at scala.tools.nsc.typechecker.Typers$Typer.body$2(Typers.scala:5279)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5283)
	at scala.tools.nsc.typechecker.Typers$Typer.typed(Typers.scala:5357)
	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.apply(Analyzer.scala:102)
	at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:430)
	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:94)
	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3$$anonfun$run$1.apply(Analyzer.scala:93)
	at scala.collection.Iterator$class.foreach(Iterator.scala:743)
	at scala.collection.AbstractIterator.foreach(Iterator.scala:1174)
	at scala.tools.nsc.typechecker.Analyzer$typerFactory$$anon$3.run(Analyzer.scala:93)
	at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1625)
	at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1610)
	at scala.tools.nsc.Global$Run.compileSources(Global.scala:1605)
	at scala.tools.nsc.Global$Run.compile(Global.scala:1703)
	at xsbt.CachedCompiler0.run(CompilerInterface.scala:123)
	at xsbt.CachedCompiler0.run(CompilerInterface.scala:99)
	at xsbt.CompilerInterface.run(CompilerInterface.scala:27)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:102)
	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:48)
	at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:41)
	at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:98)
	at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98)
	at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:98)
	at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:159)
	at sbt.compiler.AggressiveCompile$$anonfun$3.compileScala$1(AggressiveCompile.scala:97)
	at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:142)
	at sbt.compiler.AggressiveCompile$$anonfun$3.apply(AggressiveCompile.scala:86)
	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:38)
	at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:36)
	at sbt.inc.Incremental$.cycle(Incremental.scala:73)
	at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:33)
	at sbt.inc.Incremental$$anonfun$1.apply(Incremental.scala:32)
	at sbt.inc.Incremental$.manageClassfiles(Incremental.scala:41)
	at sbt.inc.Incremental$.compile(Incremental.scala:32)
	at sbt.inc.IncrementalCompile$.apply(Compile.scala:26)
	at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:150)
	at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:70)
	at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:45)
	at sbt.Compiler$.apply(Compiler.scala:70)
	at sbt.Defaults$.sbt$Defaults$$compileTaskImpl(Defaults.scala:736)
	at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:730)
	at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:730)
	at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
	at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
	at sbt.std.Transform$$anon$4.work(System.scala:64)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
	at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
	at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
	at sbt.Execute.work(Execute.scala:244)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
	at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
	at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
	at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:744)
[error] (visualization/compile:compile) java.lang.IndexOutOfBoundsException: 0
root/compile:compile
[debug] 
[debug] Initial source changes: 
[debug] 	removed:Set()
[debug] 	added: Set()
[debug] 	modified: Set()
[debug] Removed products: Set()
[debug] Modified external sources: Set()
[debug] Modified binary dependencies: Set()
[debug] Initial directly invalidated sources: Set()
[debug] 
[debug] Sources indirectly invalidated by:
[debug] 	product: Set()
[debug] 	binary dep: Set()
[debug] 	external source: Set()
[debug] All initially invalidated sources: Set()
@scabug
Copy link
Author

scabug commented Jul 23, 2014

Imported From: https://issues.scala-lang.org/browse/SI-8745?orig=1
Reporter: Emanuel Jöbstl (emiswelt)
Affected Versions: 2.11.1
Duplicates #8439

@scabug scabug closed this as completed Jul 23, 2014
@scabug
Copy link
Author

scabug commented Jul 23, 2014

@gourlaysama said:
This is an issue with using the newly generified classes in Java 7 Swing, already reported as #8439.

@scabug
Copy link
Author

scabug commented Jul 23, 2014

@scabug
Copy link
Author

scabug commented Jul 23, 2014

Emanuel Jöbstl (emiswelt) said:
I apologize. I searched for the wrong keywords when checking for duplicates. Thank you.

@scabug
Copy link
Author

scabug commented Jul 23, 2014

@gourlaysama said:
No worries. The JIRA search isn't always very helpful...

@scabug
Copy link
Author

scabug commented Jul 23, 2014

Emanuel Jöbstl (emiswelt) said:
Workaround for those seeking help while this bug is not fixed:

Remove ComboBox from layout
Create new ComboBox with new items
Insert new ComboBox
Call this.revalidate()

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

No branches or pull requests

1 participant