#913 ClassCastException Double -> Integer in Interactions Pane

open
nobody
5
2014-10-13
2011-08-27
Mathias Ricken
No

Welcome to DrJava. Working directory is /rhel5pdi/home/mricken/Desktop/gss
> double multiplier = 2
> int backoff = 1000;
> int sum = 0
> int iteration = 0;
> ++iteration; sum += backoff; backoff *= multiplier; System.out.println("Iteration "+iteration+" -> total backoff = "+sum)
Iteration 1 -> total backoff = 1000
> ++iteration; sum += backoff; backoff *= multiplier; System.out.println("Iteration "+iteration+" -> total backoff = "+sum)
>

This, however, worked:

Welcome to DrJava. Working directory is /rhel5pdi/home/mricken/Desktop/gss
> double multiplier = 2
> double backoff = 1000;
> double sum = 0
> int iteration = 0;
> ++iteration; sum += backoff; backoff *= multiplier; System.out.println("Iteration "+iteration+" -> total backoff = "+sum)
Iteration 1 -> total backoff = 1000.0
> ++iteration; sum += backoff; backoff *= multiplier; System.out.println("Iteration "+iteration+" -> total backoff = "+sum)
Iteration 2 -> total backoff = 3000.0
>

edu.rice.cs.util.UnexpectedException: java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer
at edu.rice.cs.drjava.model.repl.newjvm.MainJVM$ResultHandler.forUnexpectedException(MainJVM.java:1045)
at edu.rice.cs.drjava.model.repl.newjvm.MainJVM$ResultHandler.forUnexpectedException(MainJVM.java:992)
at edu.rice.cs.drjava.model.repl.newjvm.InterpretResult$UnexpectedExceptionResult.apply(InterpretResult.java:111)
at edu.rice.cs.drjava.model.repl.newjvm.MainJVM.interpret(MainJVM.java:351)
at edu.rice.cs.drjava.model.repl.RMIInteractionsModel._interpret(RMIInteractionsModel.java:75)
at edu.rice.cs.drjava.model.repl.InteractionsModel.interpret(InteractionsModel.java:291)
at edu.rice.cs.drjava.model.repl.InteractionsModel$2$1.run(InteractionsModel.java:241)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer
at edu.rice.cs.dynamicjava.interpreter.ExpressionEvaluator$MatchingPrimitiveBinaryOperation.value(ExpressionEvaluator.java:590)
at edu.rice.cs.dynamicjava.interpreter.ExpressionEvaluator.handleOpAssignExpression(ExpressionEvaluator.java:319)
at edu.rice.cs.dynamicjava.interpreter.ExpressionEvaluator.visit(ExpressionEvaluator.java:185)
at koala.dynamicjava.tree.AddAssignExpression.acceptVisitor(AddAssignExpression.java:64)
at edu.rice.cs.dynamicjava.interpreter.ExpressionEvaluator.value(ExpressionEvaluator.java:38)
at edu.rice.cs.dynamicjava.interpreter.StatementEvaluator.visit(StatementEvaluator.java:106)
at edu.rice.cs.dynamicjava.interpreter.StatementEvaluator.visit(StatementEvaluator.java:29)
at koala.dynamicjava.tree.ExpressionStatement.acceptVisitor(ExpressionStatement.java:101)
at edu.rice.cs.dynamicjava.interpreter.StatementEvaluator.evaluateSequence(StatementEvaluator.java:66)
at edu.rice.cs.dynamicjava.interpreter.Interpreter.evaluate(Interpreter.java:77)
at edu.rice.cs.dynamicjava.interpreter.Interpreter.interpret(Interpreter.java:47)
at edu.rice.cs.drjava.model.repl.newjvm.InterpreterJVM.interpret(InterpreterJVM.java:246)
at edu.rice.cs.drjava.model.repl.newjvm.InterpreterJVM.interpret(InterpreterJVM.java:220)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
... 1 more

Caused by:
java.lang.ClassCastException: java.lang.Double cannot be cast to java.lang.Integer
at edu.rice.cs.dynamicjava.interpreter.ExpressionEvaluator$MatchingPrimitiveBinaryOperation.value(ExpressionEvaluator.java:590)
at edu.rice.cs.dynamicjava.interpreter.ExpressionEvaluator.handleOpAssignExpression(ExpressionEvaluator.java:319)
at edu.rice.cs.dynamicjava.interpreter.ExpressionEvaluator.visit(ExpressionEvaluator.java:185)
at koala.dynamicjava.tree.AddAssignExpression.acceptVisitor(AddAssignExpression.java:64)
at edu.rice.cs.dynamicjava.interpreter.ExpressionEvaluator.value(ExpressionEvaluator.java:38)
at edu.rice.cs.dynamicjava.interpreter.StatementEvaluator.visit(StatementEvaluator.java:106)
at edu.rice.cs.dynamicjava.interpreter.StatementEvaluator.visit(StatementEvaluator.java:29)
at koala.dynamicjava.tree.ExpressionStatement.acceptVisitor(ExpressionStatement.java:101)
at edu.rice.cs.dynamicjava.interpreter.StatementEvaluator.evaluateSequence(StatementEvaluator.java:66)
at edu.rice.cs.dynamicjava.interpreter.Interpreter.evaluate(Interpreter.java:77)
at edu.rice.cs.dynamicjava.interpreter.Interpreter.interpret(Interpreter.java:47)
at edu.rice.cs.drjava.model.repl.newjvm.InterpreterJVM.interpret(InterpreterJVM.java:246)
at edu.rice.cs.drjava.model.repl.newjvm.InterpreterJVM.interpret(InterpreterJVM.java:220)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at sun.rmi.server.UnicastServerRef.dispatch(Unknown Source)
at sun.rmi.transport.Transport$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(Unknown Source)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)

System Properties:
DrJava Version drjava-20110822-r5448
DrJava Build Time 20110822-0514

drjava.debug.port = 33093
java.runtime.name = Java(TM) SE Runtime Environment
sun.boot.library.path = /usr/java/jre1.6.0_13/lib/i386
java.vm.version = 11.3-b02
java.vm.vendor = Sun Microsystems Inc.
java.vendor.url = http://java.sun.com/
path.separator = :
java.vm.name = Java HotSpot(TM) Server VM
file.encoding.pkg = sun.io
sun.java.launcher = SUN_STANDARD
user.country = US
sun.os.patch.level = unknown
java.vm.specification.name = Java Virtual Machine Specification
user.dir = /rhel5pdi<anonymized user.home>
java.runtime.version = 1.6.0_13-b03
java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
java.endorsed.dirs = /usr/java/jre1.6.0_13/lib/endorsed
os.arch = i386
java.io.tmpdir = /tmp
line.separator = "\u000a"
java.vm.specification.vendor = Sun Microsystems Inc.
os.name = Linux
sun.jnu.encoding = UTF-8
java.library.path = /usr/java/jre1.6.0_13/lib/i386/server:/usr/java/jre1.6.0_13/lib/i386:/usr/java/jre1.6.0_13/../lib/i386:/usr/java/packages/lib/i386:/lib:/usr/lib
java.specification.name = Java Platform API Specification
java.class.version = 50.0
sun.management.compiler = HotSpot Tiered Compilers
os.version = 2.6.18-164.el5
user.home = <anonymized user.home>
user.timezone = America/Los_Angeles
java.awt.printerjob = sun.print.PSPrinterJob
file.encoding = UTF-8
java.specification.version = 1.6
java.class.path = <anonymized user.home>/bin/drjava.jar
user.name = <anonymized user.name>
java.vm.specification.version = 1.0
java.home = /usr/java/jre1.6.0_13
sun.arch.data.model = 32
user.language = en
java.specification.vendor = Sun Microsystems Inc.
java.vm.info = mixed mode
java.version = 1.6.0_13
java.ext.dirs = /usr/java/jre1.6.0_13/lib/ext:/usr/java/packages/lib/ext
sun.boot.class.path = /usr/java/jre1.6.0_13/lib/resources.jar:/usr/java/jre1.6.0_13/lib/rt.jar:/usr/java/jre1.6.0_13/lib/sunrsasign.jar:/usr/java/jre1.6.0_13/lib/jsse.jar:/usr/java/jre1.6.0_13/lib/jce.jar:/usr/java/jre1.6.0_13/lib/charsets.jar:/usr/java/jre1.6.0_13/classes
java.vendor = Sun Microsystems Inc.
file.separator = /
java.vendor.url.bug = http://java.sun.com/cgi-bin/bugreport.cgi
sun.io.unicode.encoding = UnicodeLittle
sun.cpu.endian = little
java.rmi.server.hostname = 127.0.0.1
sun.desktop = gnome
sun.cpu.isalist =

DrJava configuration file
In resource bundle edu.rice.cs.drjava.config.options:
nothing

In shadowed configuration:
browser.string = /usr/bin/firefox <URL>
javac.location = /rhel5pdi/apollo/package/local_1/Linux-2.6c2.5-i686/JDK/JDK-876.0-0/jdk1.6.0/lib/tools.jar
key.delete.next = [shift DELETE]
key.delete.previous = [shift BACK_SPACE]
find.replace.match.case = false
indent.level = 4
recent.files = [/rhel5pdi<anonymized user.home>/Desktop/gss/ListSample.java,/rhel5pdi<anonymized user.home>/Desktop/gss/EnumTest.java,/rhel5pdi<anonymized user.home>/Desktop/gss/ToStringTest.java,/rhel5pdi<anonymized user.home>/Desktop/gss/GssExample.java,/rhel5pdi<anonymized user.home>/Desktop/gss/gsseg_jaas.conf]
window.height = 1127
window.width = 1610
window.x = -5
window.y = 0
window.state = 6
last.dir = /rhel5pdi<anonymized user.home>/Desktop/gss
last.interactions.dir = /rhel5pdi<anonymized user.home>/Desktop/gss
tabbedpanes.state = 840 525 700 400
new.version.notification = weekly experimental builds
new.version.notification.last = 1314031843312

Used memory: about 48.82 megabytes
Free memory: about 63.30 megabytes
Total memory: about 112.12 megabytes
Total memory can expand to: about 885.94 megabytes

Number of processors/cores: 2

Compiler Discovery Log:
makeFromFile: /rhel5pdi/apollo/package/local_1/Linux-2.6c2.5-i686/JDK/JDK-876.0-0/jdk1.6.0/lib/tools.jar --> Java 6.0, vendor: ORACLE
desc = edu.rice.cs.drjava.model.JDKDescriptor$None: none
loading debugger: edu.rice.cs.drjava.model.debug.jpda.JPDADebugger
debugger=edu.rice.cs.drjava.model.debug.jpda.JPDADebugger
From config: Oracle JDK library Java 6.0 at /rhel5pdi/apollo/package/local_1/Linux-2.6c2.5-i686/JDK/JDK-876.0-0/jdk1.6.0/lib/tools.jar, boot classpath: [/rhel5pdi/apollo/package/local_1/Linux-2.6c2.5-i686/JDK/JDK-876.0-0/jdk1.6.0/jre/lib/plugin.jar, /rhel5pdi/apollo/package/local_1/Linux-2.6c2.5-i686/JDK/JDK-876.0-0/jdk1.6.0/jre/lib/jce.jar, /rhel5pdi/apollo/package/local_1/Linux-2.6c2.5-i686/JDK/JDK-876.0-0/jdk1.6.0/jre/lib/management-agent.jar, /rhel5pdi/apollo/package/local_1/Linux-2.6c2.5-i686/JDK/JDK-876.0-0/jdk1.6.0/jre/lib/resources.jar, /rhel5pdi/apollo/package/local_1/Linux-2.6c2.5-i686/JDK/JDK-876.0-0/jdk1.6.0/jre/lib/charsets.jar, /rhel5pdi/apollo/package/local_1/Linux-2.6c2.5-i686/JDK/JDK-876.0-0/jdk1.6.0/jre/lib/javaws.jar, /rhel5pdi/apollo/package/local_1/Linux-2.6c2.5-i686/JDK/JDK-876.0-0/jdk1.6.0/jre/lib/deploy.jar, /rhel5pdi/apollo/package/local_1/Linux-2.6c2.5-i686/JDK/JDK-876.0-0/jdk1.6.0/jre/lib/jsse.jar, /rhel5pdi/apollo/package/local_1/Linux-2.6c2.5-i686/JDK/JDK-876.0-0/jdk1.6.0/jre/lib/rt.jar, /rhel5pdi/apollo/package/local_1/Linux-2.6c2.5-i686/JDK/JDK-876.0-0/jdk1.6.0/jre/lib/alt-rt.jar]
makeFromRuntime: compilerAdapter=edu.rice.cs.drjava.model.compiler.Javac160Compiler
attempt = JDK 6.0_13, isAvailable() = false
compiler=edu.rice.cs.drjava.model.compiler.NoCompilerAvailable
loading debugger: edu.rice.cs.drjava.model.debug.jpda.JPDADebugger
no debugger, LinkageError java.lang.NoClassDefFoundError: com/sun/jdi/ClassNotPreparedException
compilers found: 0
no compilers found, adding NoCompilerAvailable library
From runtime: invalid Oracle JDK library Java 6.0_13
---- Searching for Libraries ----
---- Getting Default Search Roots ----
Dir added: /usr/java/jre1.6.0_13
Dir added: /usr/java
Dir added: /usr
Dir not added: /C:/Program Files/Java
Dir not added: /C:/Program Files
Dir not added: /C:/Java
Dir not added: /C:
Dir not added: /System/Library/Frameworks/JavaVM.framework/Versions
Dir added: /usr/java
Dir not added: /usr/j2se
Dir added: /usr
Dir not added: /usr/local/java
Dir not added: /usr/local/j2se
Dir added: /usr/local
Dir added: /usr/lib/jvm
Dir not added: /usr/lib/jvm/java-6-sun
Dir not added: /usr/lib/jvm/java-1.5.0-sun
Dir not added: /usr/lib/jvm/java-6-openjdk
Dir not added: /rhel5pdi/home/javaplt/java/Linux-i686
---- Searching for descriptors ----
ms: 1314404139893
drjava.jar: <anonymized user.home>/bin/drjava.jar
jar file: java.util.jar.JarFile@4a3158
class name: edu.rice.cs.drjava.model.compiler.descriptors.EclipseDescriptor
loaded!
class name: edu.rice.cs.drjava.model.compiler.descriptors.HjDescriptor
loaded!
class name: edu.rice.cs.drjava.model.compiler.descriptors.MintDescriptor
loaded!
class name: edu.rice.cs.drjava.model.compiler.descriptors.NextGenDescriptor
loaded!
class name: edu.rice.cs.drjava.model.compiler.descriptors.SoyLatteDescriptor
loaded!
ms: 1314404139931
duration ms: 38
---- Done searching for descriptors ----
File added: /rhel5pdi<anonymized user.home>/bin/drjava.jar
Dir added: /rhel5pdi<anonymized user.home>/bin
File added: /rhel5pdi<anonymized user.home>/bin/drjava.jar
File not added: /C:/Program Files/JavaPLT/hj/lib/hjc.jar
File not added: /C:/Program Files/hj/lib/hjc.jar
File not added: /usr/local/hj/lib/hjc.jar
Dir added: /rhel5pdi<anonymized user.home>/bin
File added: /rhel5pdi<anonymized user.home>/bin/drjava.jar
File not added: /C:/Program Files/JavaPLT/JavaMint/langtools/dist/lib/classes.jar
File not added: /C:/Program Files/JavaPLT/JavaMint/langtools/dist/lib/tools.jar
File not added: /C:/Program Files/JavaMint/langtools/dist/lib/classes.jar
File not added: /C:/Program Files/JavaMint/langtools/dist/lib/tools.jar
File not added: /usr/local/JavaMint/langtools/dist/lib/classes.jar
File not added: /usr/local/JavaMint/langtools/dist/lib/tools.jar
Dir added: /rhel5pdi<anonymized user.home>/bin
File added: /rhel5pdi<anonymized user.home>/bin/drjava.jar
File not added: /C:/Program Files/JavaPLT/nextgen2/nextgen2.jar
File not added: /C:/Program Files/JavaPLT/nextgen2/jars/nextgen2.jar
File not added: /C:/Program Files/JavaPLT/nextgen2/nextgen2.jar
File not added: /C:/Program Files/JavaPLT/nextgen2/jars/nextgen2.jar
File not added: /usr/local/nextgen2/nextgen2.jar
File not added: /usr/local/nextgen2/jars/nextgen2.jar
File not added: /usr/java/jre1.6.0_13/javaws/lib/tools.jar
File not added: /usr/java/jre1.6.0_13/javaws/Classes/classes.jar
File not added: /usr/java/lib/tools.jar
File not added: /usr/java/Classes/classes.jar
File added: /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/lib/tools.jar
File not added: /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/Classes/classes.jar
File added: /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/lib/tools.jar
File not added: /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/Classes/classes.jar
File added: /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/lib/tools.jar
File not added: /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/Classes/classes.jar
File added: /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/lib/tools.jar
File not added: /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/Classes/classes.jar
File added: /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/lib/tools.jar
File not added: /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/Classes/classes.jar
---- Collecting Valid Results ----
Checking file /rhel5pdi<anonymized user.home>/bin/drjava.jar for EclipseDescriptor --> edu.rice.cs.drjava.model.compiler.EclipseCompiler
true
makeFromFile: /rhel5pdi<anonymized user.home>/bin/drjava.jar --> Java 6.0_21, vendor: UNKNOWN
desc = EclipseDescriptor --> edu.rice.cs.drjava.model.compiler.EclipseCompiler
Checking file /rhel5pdi<anonymized user.home>/bin/drjava.jar for HjDescriptor --> edu.rice.cs.drjava.model.compiler.HjCompiler
false
Checking file /rhel5pdi<anonymized user.home>/bin/drjava.jar for MintDescriptor --> edu.rice.cs.drjava.model.compiler.MintCompiler
false
Checking file /rhel5pdi<anonymized user.home>/bin/drjava.jar for NextGenDescriptor --> edu.rice.cs.drjava.model.compiler.NextGenCompiler
false
Checking file /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/lib/tools.jar for edu.rice.cs.drjava.model.JDKDescriptor$None: none
true
makeFromFile: /usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/lib/tools.jar --> Java 1.2.0, vendor: ORACLE
desc = edu.rice.cs.drjava.model.JDKDescriptor$None: none
library is not valid: compiler=false debugger=false javadoc=false
---- Getting Completed Compound Results ----
Result:
Found library: Eclipse library 6.0_21 at /rhel5pdi<anonymized user.home>/bin/drjava.jar, boot classpath: [/rhel5pdi<anonymized user.home>/bin/drjava.jar]
From search: Eclipse library 6.0_21 at /rhel5pdi<anonymized user.home>/bin/drjava.jar, boot classpath: [/rhel5pdi<anonymized user.home>/bin/drjava.jar]
tVersion: Java 6.0_21 UNKNOWN
coarsenedVersion: Java 6.0 UNKNOWN
added

Discussion