Bug 239198 - [compiler] NegativeArraySizeException thrown for triple quotes
Summary: [compiler] NegativeArraySizeException thrown for triple quotes
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.4   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 3.4.1   Edit
Assignee: David Audel CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-02 03:45 EDT by Benjamin Muskalla CLA
Modified: 2008-08-29 03:55 EDT (History)
2 users (show)

See Also:


Attachments
sourcefile (27.48 KB, text/plain)
2008-07-02 03:46 EDT, Benjamin Muskalla CLA
no flags Details
Proposed fix (2.53 KB, patch)
2008-07-03 05:03 EDT, David Audel CLA
no flags Details | Diff
Proposed fix for 3.4.1 (2.47 KB, patch)
2008-07-03 05:10 EDT, David Audel CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Muskalla CLA 2008-07-02 03:45:13 EDT
I20080613-2000

Error occurs while adding the following method to JDT/UI JavaDocTagsProcessor (HEAD):

public static void foo(String param) {
		String foo= param;
		Srtring bar = """
}

-- Error Details --
Date: Wed Jul 02 09:39:13 CEST 2008
Message: Exception occurred during problem detection:
----------------------------------- SOURCE BEGIN -------------------------------------

see attachment

----------------------------------- SOURCE END -------------------------------------
Severity: Error
Plugin: org.eclipse.jdt.core
Session Data:
eclipse.buildId=I20080613-2000
java.version=1.6.0
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US
Framework arguments:  -startup plugins/org.eclipse.equinox.launcher_1.0.100.v20080509-1800.jar -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m
Command-line arguments:  -os linux -ws gtk -arch x86 -startup plugins/org.eclipse.equinox.launcher_1.0.100.v20080509-1800.jar -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m


Exception Stack Trace:
java.lang.NegativeArraySizeException
	at org.eclipse.jdt.internal.compiler.parser.Scanner.getCurrentTokenSourceString(Scanner.java:489)
	at org.eclipse.jdt.internal.compiler.parser.Parser.recoveryTokenCheck(Parser.java:10158)
	at org.eclipse.jdt.internal.compiler.parser.Parser.updateRecoveryState(Parser.java:10456)
	at org.eclipse.jdt.internal.compiler.parser.Parser.resumeOnSyntaxError(Parser.java:10372)
	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9189)
	at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:9596)
	at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.parseStatements(MethodDeclaration.java:122)
	at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.parseMethods(TypeDeclaration.java:802)
	at org.eclipse.jdt.internal.compiler.parser.Parser.getMethodBodies(Parser.java:8513)
	at org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit(SourceElementParser.java:909)
	at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:170)
	at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:193)
	at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:257)
	at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:514)
	at org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent(CompilationUnit.java:1065)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:170)
	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:89)
	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:709)
	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:770)
	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1224)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:124)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.access$0(JavaReconcilingStrategy.java:108)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:89)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:37)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:87)
	at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:149)
	at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:86)
	at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:102)
	at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:77)
	at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:206)
Comment 1 Benjamin Muskalla CLA 2008-07-02 03:46:00 EDT
Created attachment 106282 [details]
sourcefile

here is the complete source file which leads to these exceptions
Comment 2 Philipe Mulet CLA 2008-07-02 07:27:00 EDT
Problem only occurs if enabling missing NLS tags (-warn:+nls).
It is a regression over 3.3.2, introduced in 3.4M5
Comment 3 David Audel CLA 2008-07-03 05:03:01 EDT
Created attachment 106402 [details]
Proposed fix
Comment 4 David Audel CLA 2008-07-03 05:05:54 EDT
Released for 3.5M1.

Test added
  ParserTest#test028()
Comment 5 David Audel CLA 2008-07-03 05:10:06 EDT
Created attachment 106404 [details]
Proposed fix for 3.4.1

set 'currentToken' to 0 when there is an invalid token to avoid to take into account the previous token twice (the string literal).
Comment 6 David Audel CLA 2008-07-03 05:25:13 EDT
Released for 3.4.1.

Test added
  ParserTest#test028()
Comment 7 Olivier Thomann CLA 2008-08-06 12:15:01 EDT
Verified for 3.5M1 using I20080805-1307
Comment 8 Olivier Thomann CLA 2008-08-06 12:39:55 EDT
Repen to close as RESOLVED/FIXED to be closed as VERIFIED during 3.4.1 verification pass.
Comment 9 Olivier Thomann CLA 2008-08-06 12:40:19 EDT
Fixed.
Comment 10 Frederic Fusier CLA 2008-08-29 03:55:25 EDT
Verified for 3.4.1 using M20080827-2000.