阅读:这不是我的代码产生的异常。这纯粹是建设者在犯这个错误。这不是与indexoutofbounds异常相关的任何问题的重复,因为它涉及到编写的代码。
我使用的是最新版本的eclipse,当我尝试在我的工作区中构建任何项目时,会出现以下错误
'Errors occurred during the build.
Errors running builder 'Java Builder' on project '[project]'.
offset 9673, count -7399, length 13677'
查看日志会得到完整的堆栈跟踪:
!ENTRY org.eclipse.jdt.ui 4 0 2020-11-13 22:54:50.333
!MESSAGE Error in JDT Core during reconcile
!STACK 1
Java Model Exception: java.lang.StringIndexOutOfBoundsException: offset 9673, count -7399, length 13677
at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:324)
at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:192)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:268)
at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:596)
at org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent(CompilationUnit.java:1141)
at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:173)
at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:94)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:736)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:802)
at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1318)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:131)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.access$0(JavaReconcilingStrategy.java:113)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:93)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:90)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:157)
at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:94)
at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:107)
at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:76)
at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:210)
Caused by: java.lang.StringIndexOutOfBoundsException: offset 9673, count -7399, length 13677
at java.base/java.lang.String.checkBoundsOffCount(String.java:3304)
at java.base/java.lang.String.rangeCheck(String.java:280)
at java.base/java.lang.String.<init>(String.java:276)
at org.eclipse.jdt.internal.compiler.parser.Scanner.disambiguatedToken(Scanner.java:5491)
at org.eclipse.jdt.internal.compiler.parser.Scanner.getNextToken(Scanner.java:1461)
at org.eclipse.jdt.internal.compiler.parser.diagnose.LexStream.readTokenFromScanner(LexStream.java:84)
at org.eclipse.jdt.internal.compiler.parser.diagnose.LexStream.token(LexStream.java:154)
at org.eclipse.jdt.internal.compiler.parser.diagnose.LexStream.kind(LexStream.java:194)
at org.eclipse.jdt.internal.compiler.parser.diagnose.DiagnoseParser.diagnoseParse(DiagnoseParser.java:312)
at org.eclipse.jdt.internal.compiler.parser.Parser.reportSyntaxErrors(Parser.java:14010)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12843)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12902)
at org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.parseStatements(ConstructorDeclaration.java:587)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.parseMethods(TypeDeclaration.java:1138)
at org.eclipse.jdt.internal.compiler.parser.Parser.getMethodBodies(Parser.java:11825)
at org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit(SourceElementParser.java:1058)
at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:195)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:268)
at org.eclipse.jdt.internal.core.SourceRefElement.generateInfos(SourceRefElement.java:113)
at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:596)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:326)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:312)
at org.eclipse.jdt.internal.core.SearchableEnvironment.find(SearchableEnvironment.java:184)
at org.eclipse.jdt.internal.core.SearchableEnvironment.findType(SearchableEnvironment.java:478)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.fromSplitPackageOrOracle(LookupEnvironment.java:424)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.lambda$1(LookupEnvironment.java:297)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForTypeFromModules(LookupEnvironment.java:391)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:296)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:276)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:3464)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:3175)
at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:57)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:536)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:638)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:634)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypeFor(SourceTypeBinding.java:2282)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.fields(SourceTypeBinding.java:1257)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.internalFaultInTypeForFieldsAndMethods(SourceTypeBinding.java:1224)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.faultInTypesForFieldsAndMethods(SourceTypeBinding.java:1071)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:529)
at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:1066)
at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:272)
... 19 more
Caused by: java.lang.StringIndexOutOfBoundsException: offset 9673, count -7399, length 13677
at java.base/java.lang.String.checkBoundsOffCount(String.java:3304)
at java.base/java.lang.String.rangeCheck(String.java:280)
at java.base/java.lang.String.<init>(String.java:276)
at org.eclipse.jdt.internal.compiler.parser.Scanner.disambiguatedToken(Scanner.java:5491)
at org.eclipse.jdt.internal.compiler.parser.Scanner.getNextToken(Scanner.java:1461)
at org.eclipse.jdt.internal.compiler.parser.diagnose.LexStream.readTokenFromScanner(LexStream.java:84)
at org.eclipse.jdt.internal.compiler.parser.diagnose.LexStream.token(LexStream.java:154)
at org.eclipse.jdt.internal.compiler.parser.diagnose.LexStream.kind(LexStream.java:194)
at org.eclipse.jdt.internal.compiler.parser.diagnose.DiagnoseParser.diagnoseParse(DiagnoseParser.java:312)
at org.eclipse.jdt.internal.compiler.parser.Parser.reportSyntaxErrors(Parser.java:14010)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12843)
at org.eclipse.jdt.internal.compiler.parser.Parser.parse(Parser.java:12902)
at org.eclipse.jdt.internal.compiler.ast.ConstructorDeclaration.parseStatements(ConstructorDeclaration.java:587)
at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.parseMethods(TypeDeclaration.java:1138)
at org.eclipse.jdt.internal.compiler.parser.Parser.getMethodBodies(Parser.java:11825)
at org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit(SourceElementParser.java:1058)
at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:195)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:268)
at org.eclipse.jdt.internal.core.SourceRefElement.generateInfos(SourceRefElement.java:113)
at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:596)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:326)
at org.eclipse.jdt.internal.core.JavaElement.getElementInfo(JavaElement.java:312)
at org.eclipse.jdt.internal.core.SearchableEnvironment.find(SearchableEnvironment.java:184)
at org.eclipse.jdt.internal.core.SearchableEnvironment.findType(SearchableEnvironment.java:478)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.fromSplitPackageOrOracle(LookupEnvironment.java:424)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.lambda$1(LookupEnvironment.java:297)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForTypeFromModules(LookupEnvironment.java:391)
at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:296)
at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getTypeOrPackage(PackageBinding.java:276)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:3464)
at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:3175)
at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:57)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:536)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:638)
at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:634)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.resolveTypeFor(SourceTypeBinding.java:2282)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.fields(SourceTypeBinding.java:1257)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.internalFaultInTypeForFieldsAndMethods(SourceTypeBinding.java:1224)
at org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding.faultInTypesForFieldsAndMethods(SourceTypeBinding.java:1071)
at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.faultInTypes(CompilationUnitScope.java:529)
at org.eclipse.jdt.internal.compiler.Compiler.resolve(Compiler.java:1066)
at org.eclipse.jdt.internal.core.CompilationUnitProblemFinder.process(CompilationUnitProblemFinder.java:272)
at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure(CompilationUnit.java:192)
at org.eclipse.jdt.internal.core.Openable.generateInfos(Openable.java:268)
at org.eclipse.jdt.internal.core.JavaElement.openWhenClosed(JavaElement.java:596)
at org.eclipse.jdt.internal.core.CompilationUnit.makeConsistent(CompilationUnit.java:1141)
at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.makeConsistent(ReconcileWorkingCopyOperation.java:173)
at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:94)
at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:736)
at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:802)
at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1318)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:131)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.access$0(JavaReconcilingStrategy.java:113)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy$1.run(JavaReconcilingStrategy.java:93)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:90)
at org.eclipse.jdt.internal.ui.text.java.JavaReconcilingStrategy.reconcile(JavaReconcilingStrategy.java:157)
at org.eclipse.jdt.internal.ui.text.CompositeReconcilingStrategy.reconcile(CompositeReconcilingStrategy.java:94)
at org.eclipse.jdt.internal.ui.text.JavaCompositeReconcilingStrategy.reconcile(JavaCompositeReconcilingStrategy.java:107)
at org.eclipse.jface.text.reconciler.MonoReconciler.process(MonoReconciler.java:76)
at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:210)
是什么导致了这个错误?如果我猜,是工作区的元数据或文件与实际文件不匹配,但是网上没有足够的信息来证实这一点。
我尝试过删除所有工作区元数据、清除所有eclipse配置文件、使用-clean运行eclipse,以及重新安装jdk(JDK11)。这些尝试都没有更改或删除错误。
如何删除此错误并允许eclipse重新构建?
暂无答案!
目前还没有任何答案,快来回答吧!