Bug 18922

Summary: Scrapbook does not come back when errors in snippet
Product: [Eclipse Project] JDT Reporter: Darin Swanson <Darin_Swanson>
Component: CoreAssignee: Jerome Lanneluc <jerome_lanneluc>
Status: VERIFIED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 2.0   
Target Milestone: 2.0 F3   
Hardware: PC   
OS: All   
Whiteboard:

Description Darin Swanson CLA 2002-06-03 17:06:50 EDT
Create a scrapbook page
set imports to include java.util.*
Ctrl-D "new Vector().add(new String("NOPE")"

No error, editor continues to show evaluating icon.
Comment 1 Darin Wright CLA 2002-06-04 17:46:00 EDT
Could not reproduce, I get the following error reported in the scrapbook, and 
the icon changes back to the "cursor insert".


Unmatched bracket
Syntax error on token "}", ")" expected
Comment 2 Darin Swanson CLA 2002-06-04 18:08:41 EDT
I get it every time... using JDK1.4.1_b11
Comment 3 Darin Swanson CLA 2002-06-04 18:10:44 EDT
and eclipse is launched with jdk1.4.1_b11
Comment 4 Darin Swanson CLA 2002-06-04 18:14:07 EDT
And look at this..dumped to the doc console...nowhere else

java.lang.ArrayIndexOutOfBoundsException: 1
        at org.eclipse.jdt.internal.eval.CodeSnippetToCuMapper.getImport(CodeSni
ppetToCuMapper.java:267)
        at org.eclipse.jdt.internal.eval.CodeSnippetEvaluator.addEvaluationResul
tForCompilationProblem(CodeSnippetEvaluator.java:74)
        at org.eclipse.jdt.internal.eval.Evaluator.evaluationResultsForCompilati
onProblems(Evaluator.java:67)
        at org.eclipse.jdt.internal.eval.Evaluator$1$CompilerRequestor.acceptRes
ult(Evaluator.java:93)
        at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:349)

        at org.eclipse.jdt.internal.eval.Evaluator.getClasses(Evaluator.java:129
)
        at org.eclipse.jdt.internal.eval.EvaluationContext.evaluate(EvaluationCo
ntext.java:223)
        at org.eclipse.jdt.internal.eval.EvaluationContext.evaluate(EvaluationCo
ntext.java:252)
        at org.eclipse.jdt.internal.core.eval.EvaluationContextWrapper.evaluateC
odeSnippet(EvaluationContextWrapper.java:207)
        at org.eclipse.jdt.internal.debug.eval.LocalEvaluationEngine$1.run(Local
EvaluationEngine.java:433)
        at java.lang.Thread.run(Thread.java:536)
java.lang.ArrayIndexOutOfBoundsException: 1
        at org.eclipse.jdt.internal.eval.CodeSnippetToCuMapper.getImport(CodeSni
ppetToCuMapper.java:267)
        at org.eclipse.jdt.internal.eval.CodeSnippetEvaluator.addEvaluationResul
tForCompilationProblem(CodeSnippetEvaluator.java:74)
        at org.eclipse.jdt.internal.eval.Evaluator.evaluationResultsForCompilati
onProblems(Evaluator.java:67)
        at org.eclipse.jdt.internal.eval.Evaluator$1$CompilerRequestor.acceptRes
ult(Evaluator.java:93)
        at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:349)

        at org.eclipse.jdt.internal.eval.Evaluator.getClasses(Evaluator.java:129
)
        at org.eclipse.jdt.internal.eval.EvaluationContext.evaluate(EvaluationCo
ntext.java:223)
        at org.eclipse.jdt.internal.eval.EvaluationContext.evaluate(EvaluationCo
ntext.java:252)
        at org.eclipse.jdt.internal.core.eval.EvaluationContextWrapper.evaluateC
odeSnippet(EvaluationContextWrapper.java:207)
        at org.eclipse.jdt.internal.debug.eval.LocalEvaluationEngine$1.run(Local
EvaluationEngine.java:433)
        at java.lang.Thread.run(Thread.java:536)
Comment 5 Darin Swanson CLA 2002-06-05 15:45:40 EDT
Appears to be a problem in core...only occurs if the Compiler settings are set 
to warn on unused imports.  The linenumber for the unused import problem does 
seems to causing problems when attempting to find the guilty import in the 
generated CU.

Moving to jdt core.
Comment 6 Jerome Lanneluc CLA 2002-06-06 10:11:33 EDT
getImport was not calculating the position of the import correctly (it was 1 
off).

Fixed.
Comment 7 David Audel CLA 2002-06-13 08:53:41 EDT
Verified.