com.sun.tools.javac.comp.Resolve.MethodResolutionDiagHelper.Template Java Examples
The following examples show how to use
com.sun.tools.javac.comp.Resolve.MethodResolutionDiagHelper.Template.
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: Resolve.java From TencentKona-8 with GNU General Public License v2.0 | 6 votes |
private boolean canIgnore(Symbol s) { switch (s.kind) { case ABSENT_MTH: return true; case WRONG_MTH: InapplicableSymbolError errSym = (InapplicableSymbolError)s.baseSymbol(); return new Template(MethodCheckDiag.ARITY_MISMATCH.regex()) .matches(errSym.errCandidate().snd); case WRONG_MTHS: InapplicableSymbolsError errSyms = (InapplicableSymbolsError)s.baseSymbol(); return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty(); case WRONG_STATICNESS: return false; default: return false; } }
Example #2
Source File: Resolve.java From hottub with GNU General Public License v2.0 | 6 votes |
private boolean canIgnore(Symbol s) { switch (s.kind) { case ABSENT_MTH: return true; case WRONG_MTH: InapplicableSymbolError errSym = (InapplicableSymbolError)s.baseSymbol(); return new Template(MethodCheckDiag.ARITY_MISMATCH.regex()) .matches(errSym.errCandidate().snd); case WRONG_MTHS: InapplicableSymbolsError errSyms = (InapplicableSymbolsError)s.baseSymbol(); return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty(); case WRONG_STATICNESS: return false; default: return false; } }
Example #3
Source File: Resolve.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private boolean canIgnore(Symbol s) { switch (s.kind) { case ABSENT_MTH: return true; case WRONG_MTH: InapplicableSymbolError errSym = (InapplicableSymbolError)s.baseSymbol(); return new Template(MethodCheckDiag.ARITY_MISMATCH.regex()) .matches(errSym.errCandidate().snd); case WRONG_MTHS: InapplicableSymbolsError errSyms = (InapplicableSymbolsError)s.baseSymbol(); return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty(); case WRONG_STATICNESS: return false; default: return false; } }
Example #4
Source File: Resolve.java From openjdk-jdk9 with GNU General Public License v2.0 | 6 votes |
/** * Error recovery helper: can this lookup result be ignored (for the purpose of returning * some 'better' result) ? */ boolean canIgnore() { switch (sym.kind) { case ABSENT_MTH: return true; case WRONG_MTH: InapplicableSymbolError errSym = (InapplicableSymbolError)sym.baseSymbol(); return new Template(MethodCheckDiag.ARITY_MISMATCH.regex()) .matches(errSym.errCandidate().snd); case WRONG_MTHS: InapplicableSymbolsError errSyms = (InapplicableSymbolsError)sym.baseSymbol(); return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty(); default: return false; } }
Example #5
Source File: Resolve.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
private boolean canIgnore(Symbol s) { switch (s.kind) { case ABSENT_MTH: return true; case WRONG_MTH: InapplicableSymbolError errSym = (InapplicableSymbolError)s; return new Template(MethodCheckDiag.ARITY_MISMATCH.regex()) .matches(errSym.errCandidate().snd); case WRONG_MTHS: InapplicableSymbolsError errSyms = (InapplicableSymbolsError)s; return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty(); case WRONG_STATICNESS: return false; default: return false; } }
Example #6
Source File: Resolve.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
private boolean canIgnore(Symbol s) { switch (s.kind) { case ABSENT_MTH: return true; case WRONG_MTH: InapplicableSymbolError errSym = (InapplicableSymbolError)s.baseSymbol(); return new Template(MethodCheckDiag.ARITY_MISMATCH.regex()) .matches(errSym.errCandidate().snd); case WRONG_MTHS: InapplicableSymbolsError errSyms = (InapplicableSymbolsError)s.baseSymbol(); return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty(); case WRONG_STATICNESS: return false; default: return false; } }
Example #7
Source File: Resolve.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private boolean canIgnore(Symbol s) { switch (s.kind) { case ABSENT_MTH: return true; case WRONG_MTH: InapplicableSymbolError errSym = (InapplicableSymbolError)s; return new Template(MethodCheckDiag.ARITY_MISMATCH.regex()) .matches(errSym.errCandidate().snd); case WRONG_MTHS: InapplicableSymbolsError errSyms = (InapplicableSymbolsError)s; return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty(); case WRONG_STATICNESS: return false; default: return false; } }
Example #8
Source File: Resolve.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
private boolean canIgnore(Symbol s) { switch (s.kind) { case ABSENT_MTH: return true; case WRONG_MTH: InapplicableSymbolError errSym = (InapplicableSymbolError)s.baseSymbol(); return new Template(MethodCheckDiag.ARITY_MISMATCH.regex()) .matches(errSym.errCandidate().snd); case WRONG_MTHS: InapplicableSymbolsError errSyms = (InapplicableSymbolsError)s.baseSymbol(); return errSyms.filterCandidates(errSyms.mapCandidates()).isEmpty(); case WRONG_STATICNESS: return false; default: return false; } }
Example #9
Source File: Resolve.java From hottub with GNU General Public License v2.0 | 5 votes |
Map<Symbol, JCDiagnostic> filterCandidates(Map<Symbol, JCDiagnostic> candidatesMap) { Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<Symbol, JCDiagnostic>(); for (Map.Entry<Symbol, JCDiagnostic> _entry : candidatesMap.entrySet()) { JCDiagnostic d = _entry.getValue(); if (!new Template(MethodCheckDiag.ARITY_MISMATCH.regex()).matches(d)) { candidates.put(_entry.getKey(), d); } } return candidates; }
Example #10
Source File: Resolve.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * 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 #11
Source File: Resolve.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
Map<Symbol, JCDiagnostic> filterCandidates(Map<Symbol, JCDiagnostic> candidatesMap) { Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<>(); for (Map.Entry<Symbol, JCDiagnostic> _entry : candidatesMap.entrySet()) { JCDiagnostic d = _entry.getValue(); if (!new Template(MethodCheckDiag.ARITY_MISMATCH.regex()).matches(d)) { candidates.put(_entry.getKey(), d); } } return candidates; }
Example #12
Source File: Resolve.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
Map<Symbol, JCDiagnostic> filterCandidates(Map<Symbol, JCDiagnostic> candidatesMap) { Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<Symbol, JCDiagnostic>(); for (Map.Entry<Symbol, JCDiagnostic> _entry : candidatesMap.entrySet()) { JCDiagnostic d = _entry.getValue(); if (!new Template(MethodCheckDiag.ARITY_MISMATCH.regex()).matches(d)) { candidates.put(_entry.getKey(), d); } } return candidates; }
Example #13
Source File: Resolve.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
Map<Symbol, JCDiagnostic> filterCandidates(Map<Symbol, JCDiagnostic> candidatesMap) { Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<Symbol, JCDiagnostic>(); for (Map.Entry<Symbol, JCDiagnostic> _entry : candidatesMap.entrySet()) { JCDiagnostic d = _entry.getValue(); if (!new Template(MethodCheckDiag.ARITY_MISMATCH.regex()).matches(d)) { candidates.put(_entry.getKey(), d); } } return candidates; }
Example #14
Source File: Resolve.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
Map<Symbol, JCDiagnostic> filterCandidates(Map<Symbol, JCDiagnostic> candidatesMap) { Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<Symbol, JCDiagnostic>(); for (Map.Entry<Symbol, JCDiagnostic> _entry : candidatesMap.entrySet()) { JCDiagnostic d = _entry.getValue(); if (!new Template(MethodCheckDiag.ARITY_MISMATCH.regex()).matches(d)) { candidates.put(_entry.getKey(), d); } } return candidates; }
Example #15
Source File: Resolve.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
Map<Symbol, JCDiagnostic> filterCandidates(Map<Symbol, JCDiagnostic> candidatesMap) { Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<Symbol, JCDiagnostic>(); for (Map.Entry<Symbol, JCDiagnostic> _entry : candidatesMap.entrySet()) { JCDiagnostic d = _entry.getValue(); if (!new Template(MethodCheckDiag.ARITY_MISMATCH.regex()).matches(d)) { candidates.put(_entry.getKey(), d); } } return candidates; }
Example #16
Source File: Resolve.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
Map<Symbol, JCDiagnostic> filterCandidates(Map<Symbol, JCDiagnostic> candidatesMap) { Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<Symbol, JCDiagnostic>(); for (Map.Entry<Symbol, JCDiagnostic> _entry : candidatesMap.entrySet()) { JCDiagnostic d = _entry.getValue(); if (!new Template(MethodCheckDiag.ARITY_MISMATCH.regex()).matches(d)) { candidates.put(_entry.getKey(), d); } } return candidates; }
Example #17
Source File: Resolve.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
Map<Symbol, JCDiagnostic> filterCandidates(Map<Symbol, JCDiagnostic> candidatesMap) { Map<Symbol, JCDiagnostic> candidates = new LinkedHashMap<Symbol, JCDiagnostic>(); for (Map.Entry<Symbol, JCDiagnostic> _entry : candidatesMap.entrySet()) { JCDiagnostic d = _entry.getValue(); if (!new Template(MethodCheckDiag.ARITY_MISMATCH.regex()).matches(d)) { candidates.put(_entry.getKey(), d); } } return candidates; }
Example #18
Source File: Resolve.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
@Override JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { if (name == names.error) return null; if (syms.operatorNames.contains(name)) { boolean isUnaryOp = argtypes.size() == 1; String key = argtypes.size() == 1 ? "operator.cant.be.applied" : "operator.cant.be.applied.1"; Type first = argtypes.head; Type second = !isUnaryOp ? argtypes.tail.head : null; return diags.create(dkind, log.currentSource(), pos, key, name, first, second); } else { Pair<Symbol, JCDiagnostic> c = errCandidate(); if (compactMethodDiags) { for (Map.Entry<Template, DiagnosticRewriter> _entry : MethodResolutionDiagHelper.rewriters.entrySet()) { if (_entry.getKey().matches(c.snd)) { JCDiagnostic simpleDiag = _entry.getValue().rewriteDiagnostic(diags, pos, log.currentSource(), dkind, c.snd); simpleDiag.setFlag(DiagnosticFlag.COMPRESSED); return simpleDiag; } } } Symbol ws = c.fst.asMemberOf(site, types); return diags.create(dkind, log.currentSource(), pos, "cant.apply.symbol", kindName(ws), ws.name == names.init ? ws.owner.name : ws.name, methodArguments(ws.type.getParameterTypes()), methodArguments(argtypes), kindName(ws.owner), ws.owner.type, c.snd); } }
Example #19
Source File: Resolve.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
Template(String key, Template... subTemplates) { this.regex = key; this.subTemplates = subTemplates; }
Example #20
Source File: Resolve.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
@Override JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { if (name == names.error) return null; if (syms.operatorNames.contains(name)) { boolean isUnaryOp = argtypes.size() == 1; String key = argtypes.size() == 1 ? "operator.cant.be.applied" : "operator.cant.be.applied.1"; Type first = argtypes.head; Type second = !isUnaryOp ? argtypes.tail.head : null; return diags.create(dkind, log.currentSource(), pos, key, name, first, second); } else { Pair<Symbol, JCDiagnostic> c = errCandidate(); if (compactMethodDiags) { for (Map.Entry<Template, DiagnosticRewriter> _entry : MethodResolutionDiagHelper.rewriters.entrySet()) { if (_entry.getKey().matches(c.snd)) { JCDiagnostic simpleDiag = _entry.getValue().rewriteDiagnostic(diags, pos, log.currentSource(), dkind, c.snd); simpleDiag.setFlag(DiagnosticFlag.COMPRESSED); return simpleDiag; } } } Symbol ws = c.fst.asMemberOf(site, types); return diags.create(dkind, log.currentSource(), pos, "cant.apply.symbol", kindName(ws), ws.name == names.init ? ws.owner.name : ws.name, methodArguments(ws.type.getParameterTypes()), methodArguments(argtypes), kindName(ws.owner), ws.owner.type, c.snd); } }
Example #21
Source File: Resolve.java From hottub with GNU General Public License v2.0 | 4 votes |
Template(String key, Template... subTemplates) { this.regex = key; this.subTemplates = subTemplates; }
Example #22
Source File: Resolve.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
Template(String key, Template... subTemplates) { this.regex = key; this.subTemplates = subTemplates; }
Example #23
Source File: Resolve.java From hottub with GNU General Public License v2.0 | 4 votes |
@Override JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { if (name == names.error) return null; if (syms.operatorNames.contains(name)) { boolean isUnaryOp = argtypes.size() == 1; String key = argtypes.size() == 1 ? "operator.cant.be.applied" : "operator.cant.be.applied.1"; Type first = argtypes.head; Type second = !isUnaryOp ? argtypes.tail.head : null; return diags.create(dkind, log.currentSource(), pos, key, name, first, second); } else { Pair<Symbol, JCDiagnostic> c = errCandidate(); if (compactMethodDiags) { for (Map.Entry<Template, DiagnosticRewriter> _entry : MethodResolutionDiagHelper.rewriters.entrySet()) { if (_entry.getKey().matches(c.snd)) { JCDiagnostic simpleDiag = _entry.getValue().rewriteDiagnostic(diags, pos, log.currentSource(), dkind, c.snd); simpleDiag.setFlag(DiagnosticFlag.COMPRESSED); return simpleDiag; } } } Symbol ws = c.fst.asMemberOf(site, types); return diags.create(dkind, log.currentSource(), pos, "cant.apply.symbol", kindName(ws), ws.name == names.init ? ws.owner.name : ws.name, methodArguments(ws.type.getParameterTypes()), methodArguments(argtypes), kindName(ws.owner), ws.owner.type, c.snd); } }
Example #24
Source File: Resolve.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
Template(String key, Template... subTemplates) { this.regex = key; this.subTemplates = subTemplates; }
Example #25
Source File: Resolve.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
Template(String key, Template... subTemplates) { this.regex = key; this.subTemplates = subTemplates; }
Example #26
Source File: Resolve.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
@Override JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { if (name == names.error) return null; if (syms.operatorNames.contains(name)) { boolean isUnaryOp = argtypes.size() == 1; String key = argtypes.size() == 1 ? "operator.cant.be.applied" : "operator.cant.be.applied.1"; Type first = argtypes.head; Type second = !isUnaryOp ? argtypes.tail.head : null; return diags.create(dkind, log.currentSource(), pos, key, name, first, second); } else { Pair<Symbol, JCDiagnostic> c = errCandidate(); if (compactMethodDiags) { for (Map.Entry<Template, DiagnosticRewriter> _entry : MethodResolutionDiagHelper.rewriters.entrySet()) { if (_entry.getKey().matches(c.snd)) { JCDiagnostic simpleDiag = _entry.getValue().rewriteDiagnostic(diags, pos, log.currentSource(), dkind, c.snd); simpleDiag.setFlag(DiagnosticFlag.COMPRESSED); return simpleDiag; } } } Symbol ws = c.fst.asMemberOf(site, types); return diags.create(dkind, log.currentSource(), pos, "cant.apply.symbol", kindName(ws), ws.name == names.init ? ws.owner.name : ws.name, methodArguments(ws.type.getParameterTypes()), methodArguments(argtypes), kindName(ws.owner), ws.owner.type, c.snd); } }
Example #27
Source File: Resolve.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
Template(String key, Template... subTemplates) { this.regex = key; this.subTemplates = subTemplates; }
Example #28
Source File: Resolve.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
@Override JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { if (name == names.error) return null; if (syms.operatorNames.contains(name)) { boolean isUnaryOp = argtypes.size() == 1; String key = argtypes.size() == 1 ? "operator.cant.be.applied" : "operator.cant.be.applied.1"; Type first = argtypes.head; Type second = !isUnaryOp ? argtypes.tail.head : null; return diags.create(dkind, log.currentSource(), pos, key, name, first, second); } else { Pair<Symbol, JCDiagnostic> c = errCandidate(); if (compactMethodDiags) { for (Map.Entry<Template, DiagnosticRewriter> _entry : MethodResolutionDiagHelper.rewriters.entrySet()) { if (_entry.getKey().matches(c.snd)) { JCDiagnostic simpleDiag = _entry.getValue().rewriteDiagnostic(diags, pos, log.currentSource(), dkind, c.snd); simpleDiag.setFlag(DiagnosticFlag.COMPRESSED); return simpleDiag; } } } Symbol ws = c.fst.asMemberOf(site, types); return diags.create(dkind, log.currentSource(), pos, "cant.apply.symbol", kindName(ws), ws.name == names.init ? ws.owner.name : ws.name, methodArguments(ws.type.getParameterTypes()), methodArguments(argtypes), kindName(ws.owner), ws.owner.type, c.snd); } }
Example #29
Source File: Resolve.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
Template(String key, Template... subTemplates) { this.regex = key; this.subTemplates = subTemplates; }
Example #30
Source File: Resolve.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
@Override JCDiagnostic getDiagnostic(JCDiagnostic.DiagnosticType dkind, DiagnosticPosition pos, Symbol location, Type site, Name name, List<Type> argtypes, List<Type> typeargtypes) { if (name == names.error) return null; if (syms.operatorNames.contains(name)) { boolean isUnaryOp = argtypes.size() == 1; String key = argtypes.size() == 1 ? "operator.cant.be.applied" : "operator.cant.be.applied.1"; Type first = argtypes.head; Type second = !isUnaryOp ? argtypes.tail.head : null; return diags.create(dkind, log.currentSource(), pos, key, name, first, second); } else { Pair<Symbol, JCDiagnostic> c = errCandidate(); if (compactMethodDiags) { for (Map.Entry<Template, DiagnosticRewriter> _entry : MethodResolutionDiagHelper.rewriters.entrySet()) { if (_entry.getKey().matches(c.snd)) { JCDiagnostic simpleDiag = _entry.getValue().rewriteDiagnostic(diags, pos, log.currentSource(), dkind, c.snd); simpleDiag.setFlag(DiagnosticFlag.COMPRESSED); return simpleDiag; } } } Symbol ws = c.fst.asMemberOf(site, types); return diags.create(dkind, log.currentSource(), pos, "cant.apply.symbol", kindName(ws), ws.name == names.init ? ws.owner.name : ws.name, methodArguments(ws.type.getParameterTypes()), methodArguments(argtypes), kindName(ws.owner), ws.owner.type, c.snd); } }