private static ErrorDescription createNotification( Severity severity, Tree tree, CompilationInfo info, String description, Fix fix ) { List<Fix> fixes; if ( fix != null ){ fixes = Collections.singletonList( fix ); } else { fixes = Collections.<Fix>emptyList(); } if (tree != null){ List<Integer> position = getElementPosition(info, tree); if(position.get(1) > position.get(0)) { return ErrorDescriptionFactory.createErrorDescription( severity, description, fixes, info.getFileObject(), position.get(0), position.get(1)); } } return null; }
ehm = ErrorDescriptionFactory.lazyListForFixes(Collections.<Fix>emptyList()); descs.add(ErrorDescriptionFactory.createErrorDescription(errorKind2Severity.get(d.getSeverity()), desc, ehm, doc, range[0], range[1]));
aDescription = NbBundle.getMessage(OutputListenerImpl.class, "HINT_CompilerError"); // NOI18N errors.add(ErrorDescriptionFactory.createErrorDescription(Severity.ERROR, aDescription, doc, impl.line + 1)); } else { if (aDescription == null) { aDescription = NbBundle.getMessage(OutputListenerImpl.class, "HINT_CompilerWarning"); // NOI18N errors.add(ErrorDescriptionFactory.createErrorDescription(Severity.WARNING, aDescription, doc, impl.line + 1));
private void createExpressionHint(CsmStatement st, CsmOffsetable expression, Document doc, JTextComponent comp, FileObject fo) { List<Fix> fixes = Collections.<Fix>singletonList(new IntroduceFixImpl(st, expression, doc, comp, fo)); String description = NbBundle.getMessage(LineFactoryTask.class, "IntroduceVariable.name"); //NOI18N List<ErrorDescription> hints = Collections.singletonList( ErrorDescriptionFactory.createErrorDescription(Severity.HINT, description, fixes, fo, expression.getStartOffset(), expression.getStartOffset())); HintsController.setErrors(doc, LineFactoryTask.class.getName(), hints); }
private void createStatementHint(CsmExpressionStatement expression, Document doc, FileObject fo) { List<Fix> fixes = Collections.<Fix>singletonList(new AssignmentFixImpl(expression.getExpression(), doc, fo)); String description = NbBundle.getMessage(LineFactoryTask.class, "AssignVariable.name"); //NOI18N List<ErrorDescription> hints = Collections.singletonList( ErrorDescriptionFactory.createErrorDescription(Severity.HINT, description, fixes, fo, expression.getStartOffset(), expression.getStartOffset())); HintsController.setErrors(doc, LineFactoryTask.class.getName(), hints); }
private void check(String type, String text, Document document, CfgElement elem, List<ErrorDescription> errors, ClassLoader cl, Severity severity) throws BadLocationException { if (text == null || text.isEmpty()) { return; } // non generic types try { if (!checkType(type, text, cl)) { ErrorDescription errDesc = ErrorDescriptionFactory.createErrorDescription( severity, String.format("Cannot parse '%s' as %s", text, type), document, document.createPosition(elem.getIdxStart()), document.createPosition(elem.getIdxEnd()) ); errors.add(errDesc); } } catch (IllegalArgumentException ex) { // problems instantiating type class, cannot decide, ignore } }
aDescription = NbBundle.getMessage(OutputListenerImpl.class, "HINT_CompilerError"); // NOI18N errors.add(ErrorDescriptionFactory.createErrorDescription(Severity.ERROR, aDescription, fixes, doc, impl.line + 1)); } else { if (aDescription == null) { aDescription = NbBundle.getMessage(OutputListenerImpl.class, "HINT_CompilerWarning"); // NOI18N errors.add(ErrorDescriptionFactory.createErrorDescription(Severity.WARNING, aDescription, fixes, doc, impl.line + 1));
public static ErrorDescription createProblem(Tree tree, CompilationInfo cinfo, String description, Severity severity, List<Fix> fixes) { TextSpan underlineSpan = getUnderlineSpan(cinfo, tree); return ErrorDescriptionFactory.createErrorDescription( severity, description, fixes, cinfo.getFileObject(), underlineSpan.getStartOffset(), underlineSpan.getEndOffset()); }
@Override public void addError(CsmErrorInfo info) { if (interrupter.cancelled()) { return; } PositionBounds pb = createPositionBounds(dao, info.getStartOffset(), info.getEndOffset()); ErrorDescription desc = null; if( pb != null ) { try { desc = ErrorDescriptionFactory.createErrorDescription( getSeverity(info), info.getMessage(), doc, pb.getBegin().getPosition(), pb.getEnd().getPosition()); } catch (IOException ioe) { Exceptions.printStackTrace(ioe); } descriptions.add(desc); if (TRACE_ANNOTATIONS) System.err.printf("\tadded to a bag %s\n", desc.toString()); } else { if (TRACE_ANNOTATIONS) System.err.printf("\tCan't create PositionBounds for %s\n", info); } } @Override
? formatter.format((InvalidInputError) error) : error.getClass().getSimpleName(); ErrorDescription errDesc = ErrorDescriptionFactory.createErrorDescription( severity, message,
int end = value != null ? value.getIdxEnd() : key.getIdxEnd(); fixes.add(new DeletePropFix((StyledDocument) document, key.getText(), key.getIdxStart(), end)); ErrorDescription errDesc = ErrorDescriptionFactory.createErrorDescription( severity, String.format("Duplicate of property at line %d", firstOccur.get(pName)),
/***** Annotation Stuff ********/ static void processAnnotations(NbEditorDocument doc, List<PPLine> lineList) { //XXX needs to be split for errors and warnings final ArrayList<ErrorDescription> errs = new ArrayList(); DataObject dob = NbEditorUtilities.getDataObject(doc); FileObject fo = dob == null ? null : dob.getPrimaryFile(); for (PPLine line : lineList ) { for (PPLine.Error err : line.getErrors()) { PPToken tok = err.token; int shift = (tok.getType() == LineParserTokens.END_OF_FILE || tok.getType() == LineParserTokens.END_OF_LINE || tok.getType() == LineParserTokens.OTHER_TEXT) ? Math.max(1, tok.getPadding().length()) : 0; int loff = NbDocument.findLineOffset(doc, line.getLineNumber()-1); errs.add(ErrorDescriptionFactory.createErrorDescription(err.warning ? Severity.WARNING : Severity.ERROR, err.message, fo, loff + tok.getColumn() - shift, loff + tok.getColumn() + tok.getText().length())); } ArrayList<Fix> fixes = new ArrayList(); int start = Utilities.getRowStartFromLineOffset(doc, line.getLineNumber()-1); if (line.getTokens().size() > 1 && "//#include".equals(line.getTokens().get(0).getText())) { //NOI18N fixes.add(new InlineIncludeHint((NbEditorDocument) doc,start, line.getTokens().get(1).getText())); } else if (line.getType() == PPLine.OLDIF || line.getType() == PPLine.OLDENDIF) { PPBlockInfo b = line.getBlock(); while (b != null && b.getType() != PPLine.OLDIF) { b = b.getParent(); } if (b != null) fixes.add(new ReplaceOldSyntaxHint(doc, lineList, b)); } if (line.getType() == PPLine.UNKNOWN) fixes.add(new DisableHint((NbEditorDocument) doc,start)); if (fixes.size() > 0) errs.add(ErrorDescriptionFactory.createErrorDescription(Severity.HINT, NbBundle.getMessage(DocumentPreprocessor.class, "LBL_PreprocessorHint"), fixes, doc, line.getLineNumber())); //NOI18N } HintsController.setErrors(doc, "preprocessor-errors", errs); //NOI18N }
HintsController.setErrors(_document, ComponentPeer.class.getName(), Collections.singletonList(ErrorDescriptionFactory.createErrorDescription(Severity.HINT, displayName, result, _document, span[0], span[1]))); } else { HintsController.setErrors(_document, ComponentPeer.class.getName(), Collections.<ErrorDescription>emptyList());
int end = value != null ? value.getIdxEnd() : key.getIdxEnd(); fixes.add(new DeletePropFix((StyledDocument) document, key.getText(), key.getIdxStart(), end)); ErrorDescription errDesc = ErrorDescriptionFactory.createErrorDescription( severity, String.format("Unknown Spring Boot property '%s'", pName),
fixList = Collections.emptyList(); return ErrorDescriptionFactory.createErrorDescription( severity.toEditorSeverity(), desc.getDescription(), fixList, desc.getFile(), range.getStart(), range.getEnd());
ErrorDescriptionFactory.createErrorDescription( context.getSeverity(), Bundle.OptionalEE7APIsHint_DisplayName(),
ErrorDescription errDesc; if (deprLevel == ERROR) { errDesc = ErrorDescriptionFactory.createErrorDescription( Severity.ERROR, String.format("No more supported Spring Boot property '%s'", pName), ); } else { errDesc = ErrorDescriptionFactory.createErrorDescription( Severity.WARNING, String.format("Deprecated Spring Boot property '%s'", pName),