Available Methods
- isError ( )
- getID ( )
- getSourceStart ( )
- UnusedPrivateField ( )
- getSourceEnd ( )
- IllegalRedefinitionToNonNullParameter ( )
- JavadocDuplicateThrowsClassName ( )
- UndefinedType ( )
- RedundantNullDefaultAnnotationType ( )
- LocalVariableIsNeverUsed ( )
- CannotOverrideAStaticMethodWithAnInstanceMethod ( )
- UndefinedMethod ( )
- Task ( )
- JavadocUnexpectedTag ( )
- EnumConstantMustImplementAbstractMethod ( )
- ImportNotFound ( )
- UndefinedName ( )
- ArgumentIsNeverUsed ( )
- IllegalModifierCombinationFinalVolatileForField ( )
- AmbiguousType ( )
- CannotImportPackage ( )
- JavadocInvalidTag ( )
- IllegalDefinitionToNonNullParameter ( )
- ForbiddenReference ( )
- NonStaticFieldFromStaticInvocation ( )
- UnusedTypeParameter ( )
- UnnecessaryCast ( )
- MissingOverrideAnnotationForInterfaceMethodImplementation ( )
- NonStaticAccessToStaticMethod ( )
- IllegalModifierForVariable ( )
- MethodReducesVisibility ( )
- IllegalModifierForInterfaceMethod ( )
- RequiredNonNullButProvidedNull ( )
- ParsingErrorMergeTokens ( )
- ShouldReturnValue ( )
- FieldHidingField ( )
- ArgumentHidingField ( )
- UnqualifiedFieldAccess ( )
- UnterminatedString ( )
- LocalVariableHidingLocalVariable ( )
- UnusedPrivateConstructor ( )
- InvalidUsageOfForeachStatements ( )
- DuplicateNestedType ( )
- MissingEnumConstantCase ( )
- UnusedImport ( )
- DuplicateField ( )
- ConflictingImport ( )
- NotVisibleField ( )
- DuplicateBlankFinalFieldInitialization ( )
- IllegalModifierForEnumConstructor ( )
- IllegalModifierForConstructor ( )
- PackageIsNotExpectedPackage ( )
- NonExternalizedStringLiteral ( )
- JavadocAmbiguousType ( )
- ReturnTypeMismatch ( )
- IllegalModifierForEnum ( )
- InvalidInput ( )
- NullSourceString ( )
- UnresolvedVariable ( )
- IllegalReturnNullityRedefinition ( )
- UseEnumAsAnIdentifier ( )
- UnexpectedStaticModifierForField ( )
- IllegalModifierForMemberEnum ( )
- EnumAbstractMethodMustBeImplemented ( )
- MethodCanBePotentiallyStatic ( )
- TypeMissingDeprecatedAnnotation ( )
- RedundantSpecificationOfTypeArguments ( )
- IncompatibleExceptionInThrowsClause ( )
- UnhandledWarningToken ( )
- NonStaticOrAlienTypeReceiver ( )
- ParsingErrorInsertToCompletePhrase ( )
- ParsingErrorNoSuggestion ( )
- UnhandledExceptionInDefaultConstructor ( )
- RawTypeReference ( )
- UndefinedAnnotationMember ( )
- AbstractMethodMustBeImplemented ( )
Related Classes
- java.util.Arrays
- java.io.File
- java.io.InputStream
- java.util.Iterator
- java.util.Locale
- org.eclipse.core.runtime.CoreException
- org.eclipse.core.runtime.NullProgressMonitor
- org.eclipse.jdt.core.dom.CompilationUnit
- org.eclipse.jdt.core.IJavaProject
- org.eclipse.jdt.core.JavaModelException
- org.eclipse.jdt.core.ICompilationUnit
- org.eclipse.jdt.core.dom.SimpleName
- org.eclipse.jdt.core.dom.ASTNode
- org.eclipse.jdt.core.dom.Modifier
- org.eclipse.jdt.core.IPackageFragment
- org.eclipse.jdt.core.dom.ITypeBinding
- org.eclipse.jdt.internal.compiler.impl.CompilerOptions
- org.eclipse.jdt.core.dom.IMethodBinding
- org.eclipse.ltk.core.refactoring.RefactoringStatus
- org.eclipse.jdt.core.search.IJavaSearchConstants
- org.eclipse.jdt.core.dom.BodyDeclaration
- org.eclipse.lsp4j.TextDocumentIdentifier
- org.eclipse.jdt.internal.compiler.env.ICompilationUnit
- org.eclipse.lsp4j.Range
- org.eclipse.lsp4j.jsonrpc.messages.Either
Java Code Examples for org.eclipse.jdt.core.compiler.IProblem#PackageIsNotExpectedPackage
The following examples show how to use
org.eclipse.jdt.core.compiler.IProblem#PackageIsNotExpectedPackage .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BaseDiagnosticsHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 5 votes |
public boolean isSyntaxLikeError(IProblem problem) { //Syntax issues are always reported if ((problem.getID() & IProblem.Syntax) != 0) { return true; } if (!isDefaultProject && problem.getID() == IProblem.PackageIsNotExpectedPackage) { return false; } //Type and Import issues are never reported if ((problem.getID() & IProblem.TypeRelated) != 0 || // (problem.getID() & IProblem.ImportRelated) != 0) { return false; } //For the rest, we need to cherry pick what is ignored or not switch (problem.getID()) { case IProblem.AbstractMethodMustBeImplemented: case IProblem.AmbiguousMethod: case IProblem.DanglingReference: case IProblem.MethodMustOverrideOrImplement: case IProblem.MissingReturnType: case IProblem.MissingTypeInConstructor: case IProblem.MissingTypeInLambda: case IProblem.MissingTypeInMethod: case IProblem.UndefinedConstructor: case IProblem.UndefinedField: case IProblem.UndefinedMethod: case IProblem.UndefinedName: case IProblem.UnresolvedVariable: return false; default: //We log problems for troubleshooting purposes String error = getError(problem); JavaLanguageServerPlugin.logInfo(problem.getMessage() + " is of type " + error); } return true; }
Example 2
Source File: BaseDocumentLifeCycleHandler.java From eclipse.jdt.ls with Eclipse Public License 2.0 | 4 votes |
private ICompilationUnit checkPackageDeclaration(String uri, ICompilationUnit unit) { if (unit.getResource() != null && unit.getJavaProject() != null && unit.getJavaProject().getProject().getName().equals(ProjectsManager.DEFAULT_PROJECT_NAME)) { try { CompilationUnit astRoot = CoreASTProvider.getInstance().getAST(unit, CoreASTProvider.WAIT_YES, new NullProgressMonitor()); IProblem[] problems = astRoot.getProblems(); for (IProblem problem : problems) { if (problem.getID() == IProblem.PackageIsNotExpectedPackage) { IResource file = unit.getResource(); boolean toRemove = file.isLinked(); if (toRemove) { IPath path = file.getParent().getProjectRelativePath(); if (path.segmentCount() > 0 && JDTUtils.SRC.equals(path.segments()[0])) { String packageNameResource = path.removeFirstSegments(1).toString().replace(JDTUtils.PATH_SEPARATOR, JDTUtils.PERIOD); path = file.getLocation(); if (path != null && path.segmentCount() > 0) { path = path.removeLastSegments(1); String pathStr = path.toString().replace(JDTUtils.PATH_SEPARATOR, JDTUtils.PERIOD); if (pathStr.endsWith(packageNameResource)) { toRemove = false; } } } } if (toRemove) { file.delete(true, new NullProgressMonitor()); if (unit.equals(sharedASTProvider.getActiveJavaElement())) { sharedASTProvider.disposeAST(); } unit.discardWorkingCopy(); unit = JDTUtils.resolveCompilationUnit(uri); unit.becomeWorkingCopy(new NullProgressMonitor()); triggerValidation(unit); } break; } } } catch (CoreException e) { JavaLanguageServerPlugin.logException(e.getMessage(), e); } } return unit; }