com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag Java Examples

The following examples show how to use com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag. 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: Check.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/** Check that usage of diamond operator is correct (i.e. diamond should not
 * be used with non-generic classes or in anonymous class creation expressions)
 */
Type checkDiamond(JCNewClass tree, Type t) {
    if (!TreeInfo.isDiamond(tree) ||
            t.isErroneous()) {
        return checkClassType(tree.clazz.pos(), t, true);
    } else {
        if (tree.def != null && !allowDiamondWithAnonymousClassCreation) {
            log.error(DiagnosticFlag.SOURCE_LEVEL, tree.clazz.pos(),
                    Errors.CantApplyDiamond1(t, Fragments.DiamondAndAnonClassNotSupportedInSource(source.name)));
        }
        if (t.tsym.type.getTypeArguments().isEmpty()) {
            log.error(tree.clazz.pos(),
                      Errors.CantApplyDiamond1(t,
                                               Fragments.DiamondNonGeneric(t)));
            return types.createErrorType(t);
        } else if (tree.typeargs != null &&
                tree.typeargs.nonEmpty()) {
            log.error(tree.clazz.pos(),
                      Errors.CantApplyDiamond1(t,
                                               Fragments.DiamondAndExplicitParams(t)));
            return types.createErrorType(t);
        } else {
            return t;
        }
    }
}
 
Example #2
Source File: Check.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void checkImportedPackagesObservable(final JCCompilationUnit toplevel) {
    OUTER: for (JCImport imp : toplevel.getImports()) {
        if (!imp.staticImport && TreeInfo.name(imp.qualid) == names.asterisk) {
            TypeSymbol tsym = ((JCFieldAccess)imp.qualid).selected.type.tsym;
            if (toplevel.modle.visiblePackages != null) {
                //TODO - unclear: selects like javax.* will get resolved from the current module
                //(as javax is not an exported package from any module). And as javax in the current
                //module typically does not contain any classes or subpackages, we need to go through
                //the visible packages to find a sub-package:
                for (PackageSymbol known : toplevel.modle.visiblePackages.values()) {
                    if (Convert.packagePart(known.fullname) == tsym.flatName())
                        continue OUTER;
                }
            }
            if (tsym.kind == PCK && tsym.members().isEmpty() && !tsym.exists()) {
                log.error(DiagnosticFlag.RESOLVE_ERROR, imp.pos, Errors.DoesntExist(tsym));
            }
        }
    }
}
 
Example #3
Source File: Check.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
/** Check that usage of diamond operator is correct (i.e. diamond should not
 * be used with non-generic classes or in anonymous class creation expressions)
 */
Type checkDiamond(JCNewClass tree, Type t) {
    if (!TreeInfo.isDiamond(tree) ||
            t.isErroneous()) {
        return checkClassType(tree.clazz.pos(), t, true);
    } else {
        if (tree.def != null && !allowDiamondWithAnonymousClassCreation) {
            log.error(DiagnosticFlag.SOURCE_LEVEL, tree.clazz.pos(),
                    Errors.CantApplyDiamond1(t, Fragments.DiamondAndAnonClassNotSupportedInSource(source.name)));
        }
        if (t.tsym.type.getTypeArguments().isEmpty()) {
            log.error(tree.clazz.pos(),
                "cant.apply.diamond.1",
                t, diags.fragment("diamond.non.generic", t));
            return types.createErrorType(t);
        } else if (tree.typeargs != null &&
                tree.typeargs.nonEmpty()) {
            log.error(tree.clazz.pos(),
                "cant.apply.diamond.1",
                t, diags.fragment("diamond.and.explicit.params", t));
            return types.createErrorType(t);
        } else {
            return t;
        }
    }
}
 
Example #4
Source File: MemberEnter.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 6 votes vote down vote up
/** Import all classes of a class or package on demand.
 *  @param pos           Position to be used for error reporting.
 *  @param tsym          The class or package the members of which are imported.
 *  @param env           The env in which the imported classes will be entered.
 */
private void importAll(int pos,
                       final TypeSymbol tsym,
                       Env<AttrContext> env) {
    // Check that packages imported from exist (JLS ???).
    if (tsym.kind == PCK && tsym.members().elems == null && !tsym.exists()) {
        // If we can't find java.lang, exit immediately.
        if (((PackageSymbol)tsym).fullname.equals(names.java_lang)) {
            JCDiagnostic msg = diags.fragment("fatal.err.no.java.lang");
            throw new FatalError(msg);
        } else {
            log.error(DiagnosticFlag.RESOLVE_ERROR, pos, "doesnt.exist", tsym);
        }
    }
    env.toplevel.starImportScope.importAll(tsym.members());
}
 
Example #5
Source File: MemberEnter.java    From java-n-IDE-for-Android with Apache License 2.0 6 votes vote down vote up
/** Import all classes of a class or package on demand.
 *  @param pos           Position to be used for error reporting.
 *  @param tsym          The class or package the members of which are imported.
 *  @param toScope   The (import) scope in which imported classes
 *               are entered.
 */
private void importAll(int pos,
                       final TypeSymbol tsym,
                       Env<AttrContext> env) {
    // Check that packages imported from exist (JLS ???).
    if (tsym.kind == PCK && tsym.members().elems == null && !tsym.exists()) {
        // If we can't find java.lang, exit immediately.
        if (((PackageSymbol)tsym).fullname.equals(names.java_lang)) {
            JCDiagnostic msg = diags.fragment("fatal.err.no.java.lang");
            throw new FatalError(msg);
        } else {
            log.error(DiagnosticFlag.RESOLVE_ERROR, pos, "doesnt.exist", tsym);
        }
    }
    env.toplevel.starImportScope.importAll(tsym.members());
}
 
Example #6
Source File: MemberEnter.java    From jdk8u60 with GNU General Public License v2.0 6 votes vote down vote up
/** Import all classes of a class or package on demand.
 *  @param pos           Position to be used for error reporting.
 *  @param tsym          The class or package the members of which are imported.
 *  @param env           The env in which the imported classes will be entered.
 */
private void importAll(int pos,
                       final TypeSymbol tsym,
                       Env<AttrContext> env) {
    // Check that packages imported from exist (JLS ???).
    if (tsym.kind == PCK && tsym.members().elems == null && !tsym.exists()) {
        // If we can't find java.lang, exit immediately.
        if (((PackageSymbol)tsym).fullname.equals(names.java_lang)) {
            JCDiagnostic msg = diags.fragment("fatal.err.no.java.lang");
            throw new FatalError(msg);
        } else {
            log.error(DiagnosticFlag.RESOLVE_ERROR, pos, "doesnt.exist", tsym);
        }
    }
    env.toplevel.starImportScope.importAll(tsym.members());
}
 
Example #7
Source File: MemberEnter.java    From javaide with GNU General Public License v3.0 6 votes vote down vote up
/** Import all classes of a class or package on demand.
 *  @param pos           Position to be used for error reporting.
 *  @param tsym          The class or package the members of which are imported.
 *  @param toScope   The (import) scope in which imported classes
 *               are entered.
 */
private void importAll(int pos,
                       final TypeSymbol tsym,
                       Env<AttrContext> env) {
    // Check that packages imported from exist (JLS ???).
    if (tsym.kind == PCK && tsym.members().elems == null && !tsym.exists()) {
        // If we can't find java.lang, exit immediately.
        if (((PackageSymbol)tsym).fullname.equals(names.java_lang)) {
            JCDiagnostic msg = diags.fragment("fatal.err.no.java.lang");
            throw new FatalError(msg);
        } else {
            log.error(DiagnosticFlag.RESOLVE_ERROR, pos, "doesnt.exist", tsym);
        }
    }
    env.toplevel.starImportScope.importAll(tsym.members());
}
 
Example #8
Source File: MemberEnter.java    From TencentKona-8 with GNU General Public License v2.0 6 votes vote down vote up
/** Import all classes of a class or package on demand.
 *  @param pos           Position to be used for error reporting.
 *  @param tsym          The class or package the members of which are imported.
 *  @param env           The env in which the imported classes will be entered.
 */
private void importAll(int pos,
                       final TypeSymbol tsym,
                       Env<AttrContext> env) {
    // Check that packages imported from exist (JLS ???).
    if (tsym.kind == PCK && tsym.members().elems == null && !tsym.exists()) {
        // If we can't find java.lang, exit immediately.
        if (((PackageSymbol)tsym).fullname.equals(names.java_lang)) {
            JCDiagnostic msg = diags.fragment("fatal.err.no.java.lang");
            throw new FatalError(msg);
        } else {
            log.error(DiagnosticFlag.RESOLVE_ERROR, pos, "doesnt.exist", tsym);
        }
    }
    env.toplevel.starImportScope.importAll(tsym.members());
}
 
Example #9
Source File: Check.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public void checkImportedPackagesObservable(final JCCompilationUnit toplevel) {
    OUTER: for (JCImport imp : toplevel.getImports()) {
        if (!imp.staticImport && TreeInfo.name(imp.qualid) == names.asterisk) {
            TypeSymbol tsym = ((JCFieldAccess)imp.qualid).selected.type.tsym;
            if (toplevel.modle.visiblePackages != null) {
                //TODO - unclear: selects like javax.* will get resolved from the current module
                //(as javax is not an exported package from any module). And as javax in the current
                //module typically does not contain any classes or subpackages, we need to go through
                //the visible packages to find a sub-package:
                for (PackageSymbol known : toplevel.modle.visiblePackages.values()) {
                    if (Convert.packagePart(known.fullname) == tsym.flatName())
                        continue OUTER;
                }
            }
            if (tsym.kind == PCK && tsym.members().isEmpty() && !tsym.exists()) {
                log.error(DiagnosticFlag.RESOLVE_ERROR, imp.pos, "doesnt.exist", tsym);
            }
        }
    }
}
 
Example #10
Source File: Log.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void report(JCDiagnostic diag) {
    if (!diag.isFlagSet(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE) &&
        (filter == null || filter.accepts(diag))) {
        deferred.add(diag);
    } else {
        prev.report(diag);
    }
}
 
Example #11
Source File: Resolve.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
private void logResolveError(ResolveError error,
        DiagnosticPosition pos,
        Symbol location,
        Type site,
        Name name,
        List<Type> argtypes,
        List<Type> typeargtypes) {
    JCDiagnostic d = error.getDiagnostic(JCDiagnostic.DiagnosticType.ERROR,
            pos, location, site, name, argtypes, typeargtypes);
    if (d != null) {
        d.setFlag(DiagnosticFlag.RESOLVE_ERROR);
        log.report(d);
    }
}
 
Example #12
Source File: TypeEnter.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/** Import statics types of a given name.  Non-types are handled in Attr.
 *  @param imp           The import that is being handled.
 *  @param tsym          The class from which the name is imported.
 *  @param name          The (simple) name being imported.
 *  @param env           The environment containing the named import
 *                  scope to add to.
 */
private void importNamedStatic(final JCImport imp,
                               final TypeSymbol tsym,
                               final Name name,
                               final Env<AttrContext> env) {
    if (tsym.kind != TYP) {
        log.error(DiagnosticFlag.RECOVERABLE, imp.pos(), Errors.StaticImpOnlyClassesAndInterfaces);
        return;
    }

    final NamedImportScope toScope = env.toplevel.namedImportScope;
    final Scope originMembers = tsym.members();

    imp.importScope = toScope.importByName(types, originMembers, name, staticImportFilter, imp, cfHandler);
}
 
Example #13
Source File: Resolve.java    From java-n-IDE-for-Android with Apache License 2.0 5 votes vote down vote up
private void logResolveError(ResolveError error,
        DiagnosticPosition pos,
        Symbol location,
        Type site,
        Name name,
        List<Type> argtypes,
        List<Type> typeargtypes) {
    JCDiagnostic d = error.getDiagnostic(DiagnosticType.ERROR,
            pos, location, site, name, argtypes, typeargtypes);
    if (d != null) {
        d.setFlag(DiagnosticFlag.RESOLVE_ERROR);
        log.report(d);
    }
}
 
Example #14
Source File: Hacks.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static boolean isSyntaxError(Diagnostic<?> d) {
    JCDiagnostic jcd = getJCDiagnostic(d);
    if (jcd == null) {
        return false;
    }
    return jcd.isFlagSet(DiagnosticFlag.SYNTAX);
}
 
Example #15
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Main entry point for diagnostic rewriting - given a diagnostic, see if any templates matches it,
 * and rewrite it accordingly.
 */
static JCDiagnostic rewrite(JCDiagnostic.Factory diags, DiagnosticPosition pos, DiagnosticSource source,
                            DiagnosticType dkind, JCDiagnostic d) {
    for (Map.Entry<Template, DiagnosticRewriter> _entry : rewriters.entrySet()) {
        if (_entry.getKey().matches(d)) {
            JCDiagnostic simpleDiag =
                    _entry.getValue().rewriteDiagnostic(diags, pos, source, dkind, d);
            simpleDiag.setFlag(DiagnosticFlag.COMPRESSED);
            return simpleDiag;
        }
    }
    return null;
}
 
Example #16
Source File: Resolve.java    From javaide with GNU General Public License v3.0 5 votes vote down vote up
private void logResolveError(ResolveError error,
        DiagnosticPosition pos,
        Symbol location,
        Type site,
        Name name,
        List<Type> argtypes,
        List<Type> typeargtypes) {
    JCDiagnostic d = error.getDiagnostic(DiagnosticType.ERROR,
            pos, location, site, name, argtypes, typeargtypes);
    if (d != null) {
        d.setFlag(DiagnosticFlag.RESOLVE_ERROR);
        log.report(d);
    }
}
 
Example #17
Source File: TypeEnter.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/** Import statics types of a given name.  Non-types are handled in Attr.
 *  @param imp           The import that is being handled.
 *  @param tsym          The class from which the name is imported.
 *  @param name          The (simple) name being imported.
 *  @param env           The environment containing the named import
 *                  scope to add to.
 */
private void importNamedStatic(final JCImport imp,
                               final TypeSymbol tsym,
                               final Name name,
                               final Env<AttrContext> env) {
    if (tsym.kind != TYP) {
        log.error(DiagnosticFlag.RECOVERABLE, imp.pos(), "static.imp.only.classes.and.interfaces");
        return;
    }

    final NamedImportScope toScope = env.toplevel.namedImportScope;
    final Scope originMembers = tsym.members();

    imp.importScope = toScope.importByName(types, originMembers, name, staticImportFilter, imp, cfHandler);
}
 
Example #18
Source File: Resolve.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void logResolveError(ResolveError error,
        DiagnosticPosition pos,
        Symbol location,
        Type site,
        Name name,
        List<Type> argtypes,
        List<Type> typeargtypes) {
    JCDiagnostic d = error.getDiagnostic(JCDiagnostic.DiagnosticType.ERROR,
            pos, location, site, name, argtypes, typeargtypes);
    if (d != null) {
        d.setFlag(DiagnosticFlag.RESOLVE_ERROR);
        log.report(d);
    }
}
 
Example #19
Source File: Resolve.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
private void logResolveError(ResolveError error,
        DiagnosticPosition pos,
        Symbol location,
        Type site,
        Name name,
        List<Type> argtypes,
        List<Type> typeargtypes) {
    JCDiagnostic d = error.getDiagnostic(JCDiagnostic.DiagnosticType.ERROR,
            pos, location, site, name, argtypes, typeargtypes);
    if (d != null) {
        d.setFlag(DiagnosticFlag.RESOLVE_ERROR);
        log.report(d);
    }
}
 
Example #20
Source File: JavacTrees.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private void printMessage(Diagnostic.Kind kind, CharSequence msg,
        JCDiagnostic.DiagnosticPosition pos,
        com.sun.source.tree.CompilationUnitTree root) {
    JavaFileObject oldSource = null;
    JavaFileObject newSource = null;

    newSource = root.getSourceFile();
    if (newSource == null) {
        pos = null;
    } else {
        oldSource = log.useSource(newSource);
    }

    try {
        switch (kind) {
        case ERROR:
            log.error(DiagnosticFlag.MULTIPLE, pos, "proc.messager", msg.toString());
            break;

        case WARNING:
            log.warning(pos, "proc.messager", msg.toString());
            break;

        case MANDATORY_WARNING:
            log.mandatoryWarning(pos, "proc.messager", msg.toString());
            break;

        default:
            log.note(pos, "proc.messager", msg.toString());
        }
    } finally {
        if (oldSource != null)
            log.useSource(oldSource);
    }
}
 
Example #21
Source File: JavacParser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
void checkTypeAnnotations() {
    if (!allowTypeAnnotations) {
        log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, "type.annotations.not.supported.in.source", source.name);
    }
}
 
Example #22
Source File: CompletenessAnalyzer.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void error(DiagnosticFlag flag, DiagnosticPosition pos, String key, Object... args) {
    die();
}
 
Example #23
Source File: JavacParser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
void checkMethodReferences() {
    if (!allowMethodReferences) {
        log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, "method.references.not.supported.in.source", source.name);
    }
}
 
Example #24
Source File: Resolve.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@Override
JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind,
        DiagnosticPosition pos,
        Symbol location,
        Type site,
        Name name,
        List<Type> argtypes,
        List<Type> typeargtypes) {
    Map<Symbol, JCDiagnostic> candidatesMap = mapCandidates();
    Map<Symbol, JCDiagnostic> filteredCandidates = compactMethodDiags ?
            filterCandidates(candidatesMap) :
            mapCandidates();
    if (filteredCandidates.isEmpty()) {
        filteredCandidates = candidatesMap;
    }
    boolean truncatedDiag = candidatesMap.size() != filteredCandidates.size();
    if (filteredCandidates.size() > 1) {
        JCDiagnostic err = diags.create(dkind,
                null,
                truncatedDiag ?
                    EnumSet.of(DiagnosticFlag.COMPRESSED) :
                    EnumSet.noneOf(DiagnosticFlag.class),
                log.currentSource(),
                pos,
                "cant.apply.symbols",
                name == names.init ? KindName.CONSTRUCTOR : kind.absentKind(),
                name == names.init ? site.tsym.name : name,
                methodArguments(argtypes));
        return new JCDiagnostic.MultilineDiagnostic(err, candidateDetails(filteredCandidates, site));
    } else if (filteredCandidates.size() == 1) {
        Map.Entry<Symbol, JCDiagnostic> _e =
                        filteredCandidates.entrySet().iterator().next();
        final Pair<Symbol, JCDiagnostic> p = new Pair<>(_e.getKey(), _e.getValue());
        JCDiagnostic d = new InapplicableSymbolError(resolveContext) {
            @Override
            protected Pair<Symbol, JCDiagnostic> errCandidate() {
                return p;
            }
        }.getDiagnostic(dkind, pos,
            location, site, name, argtypes, typeargtypes);
        if (truncatedDiag) {
            d.setFlag(DiagnosticFlag.COMPRESSED);
        }
        return d;
    } else {
        return new SymbolNotFoundError(ABSENT_MTH).getDiagnostic(dkind, pos,
            location, site, name, argtypes, typeargtypes);
    }
}
 
Example #25
Source File: JavacParser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
void checkTryWithResources() {
    if (!allowTWR) {
        log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, "try.with.resources.not.supported.in.source", source.name);
    }
}
 
Example #26
Source File: JavacParser.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
protected void checkAnnotationsAfterTypeParams(int pos) {
    if (!allowAnnotationsAfterTypeParams) {
        log.error(DiagnosticFlag.SOURCE_LEVEL, pos, Errors.AnnotationsAfterTypeParamsNotSupportedInSource(source.name));
    }
}
 
Example #27
Source File: JavacMessager.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * Prints a message of the specified kind at the location of the
 * annotation value inside the annotation mirror of the annotated
 * element.
 *
 * @param kind the kind of message
 * @param msg  the message, or an empty string if none
 * @param e    the annotated element
 * @param a    the annotation containing the annotaiton value
 * @param v    the annotation value to use as a position hint
 */
@DefinedBy(Api.ANNOTATION_PROCESSING)
public void printMessage(Diagnostic.Kind kind, CharSequence msg,
                  Element e, AnnotationMirror a, AnnotationValue v) {
    JavaFileObject oldSource = null;
    JavaFileObject newSource = null;
    JCDiagnostic.DiagnosticPosition pos = null;
    JavacElements elemUtils = processingEnv.getElementUtils();
    Pair<JCTree, JCCompilationUnit> treeTop = elemUtils.getTreeAndTopLevel(e, a, v);
    if (treeTop != null) {
        newSource = treeTop.snd.sourcefile;
        if (newSource != null) {
            // save the old version and reinstate it later
            oldSource = log.useSource(newSource);
            pos = treeTop.fst.pos();
        }
    }
    try {
        switch (kind) {
        case ERROR:
            errorCount++;
            log.error(DiagnosticFlag.MULTIPLE, pos, Errors.ProcMessager(msg.toString()));
            break;

        case WARNING:
            warningCount++;
            log.warning(pos, Warnings.ProcMessager(msg.toString()));
            break;

        case MANDATORY_WARNING:
            warningCount++;
            log.mandatoryWarning(pos, Warnings.ProcMessager(msg.toString()));
            break;

        default:
            log.note(pos, Notes.ProcMessager(msg.toString()));
            break;
        }
    } finally {
        // reinstate the saved version, only if it was saved earlier
        if (newSource != null)
            log.useSource(oldSource);
    }
}
 
Example #28
Source File: JavacParser.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
void checkPrivateInterfaceMethods() {
    if (!allowPrivateInterfaceMethods) {
        log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, Errors.PrivateIntfMethodsNotSupportedInSource(source.name));
    }
}
 
Example #29
Source File: Check.java    From lua-for-android with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/** Report a failure to complete a class.
 *  @param pos        Position to be used for error reporting.
 *  @param ex         The failure to report.
 */
public Type completionError(DiagnosticPosition pos, CompletionFailure ex) {
    log.error(JCDiagnostic.DiagnosticFlag.NON_DEFERRABLE, pos, Errors.CantAccess(ex.sym, ex.getDetailValue()));
    return syms.errType;
}
 
Example #30
Source File: JavacParser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
void checkDefaultMethods() {
    if (!allowDefaultMethods) {
        log.error(DiagnosticFlag.SOURCE_LEVEL, token.pos, "default.methods.not.supported.in.source", source.name);
    }
}