< prev index next >

src/jdk.compiler/share/classes/com/sun/tools/javac/api/JavacTrees.java

Print this page

        

*** 1,7 **** /* ! * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this --- 1,7 ---- /* ! * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this
*** 407,420 **** return sym; } @Override @DefinedBy(Api.COMPILER_TREE) public Element getElement(DocTreePath path) { ! DocTree forTree = path.getLeaf(); ! if (forTree instanceof DCReference) ! return attributeDocReference(path.getTreePath(), ((DCReference) forTree)); ! if (forTree instanceof DCIdentifier) { if (path.getParentPath().getLeaf() instanceof DCParam) { return attributeParamIdentifier(path.getTreePath(), (DCParam) path.getParentPath().getLeaf()); } } return null; --- 407,420 ---- return sym; } @Override @DefinedBy(Api.COMPILER_TREE) public Element getElement(DocTreePath path) { ! DocTree tree = path.getLeaf(); ! if (tree instanceof DCReference) ! return attributeDocReference(path.getTreePath(), ((DCReference) tree)); ! if (tree instanceof DCIdentifier) { if (path.getParentPath().getLeaf() instanceof DCParam) { return attributeParamIdentifier(path.getTreePath(), (DCParam) path.getParentPath().getLeaf()); } } return null;
*** 523,562 **** } finally { log.popDiagnosticHandler(deferredDiagnosticHandler); } } ! private Symbol attributeParamIdentifier(TreePath path, DCParam ptag) { Symbol javadocSymbol = getElement(path); if (javadocSymbol == null) return null; ElementKind kind = javadocSymbol.getKind(); List<? extends Symbol> params = List.nil(); if (kind == ElementKind.METHOD || kind == ElementKind.CONSTRUCTOR) { MethodSymbol ee = (MethodSymbol) javadocSymbol; ! params = ptag.isTypeParameter() ? ee.getTypeParameters() : ee.getParameters(); } else if (kind.isClass() || kind.isInterface()) { ClassSymbol te = (ClassSymbol) javadocSymbol; ! params = te.getTypeParameters(); } for (Symbol param : params) { ! if (param.getSimpleName() == ptag.getName().getName()) { return param; } } return null; } - /** @see com.sun.tools.javadoc.ClassDocImpl#findField */ private VarSymbol findField(ClassSymbol tsym, Name fieldName) { return searchField(tsym, fieldName, new HashSet<>()); } - /** @see com.sun.tools.javadoc.ClassDocImpl#searchField */ private VarSymbol searchField(ClassSymbol tsym, Name fieldName, Set<ClassSymbol> searched) { if (searched.contains(tsym)) { return null; } searched.add(tsym); --- 523,562 ---- } finally { log.popDiagnosticHandler(deferredDiagnosticHandler); } } ! private Symbol attributeParamIdentifier(TreePath path, DCParam paramTag) { Symbol javadocSymbol = getElement(path); if (javadocSymbol == null) return null; ElementKind kind = javadocSymbol.getKind(); List<? extends Symbol> params = List.nil(); if (kind == ElementKind.METHOD || kind == ElementKind.CONSTRUCTOR) { MethodSymbol ee = (MethodSymbol) javadocSymbol; ! params = paramTag.isTypeParameter() ? ee.getTypeParameters() : ee.getParameters(); } else if (kind.isClass() || kind.isInterface()) { ClassSymbol te = (ClassSymbol) javadocSymbol; ! params = paramTag.isTypeParameter() ! ? te.getTypeParameters() ! : te.getStateComponents(); } for (Symbol param : params) { ! if (param.getSimpleName() == paramTag.getName().getName()) { return param; } } return null; } private VarSymbol findField(ClassSymbol tsym, Name fieldName) { return searchField(tsym, fieldName, new HashSet<>()); } private VarSymbol searchField(ClassSymbol tsym, Name fieldName, Set<ClassSymbol> searched) { if (searched.contains(tsym)) { return null; } searched.add(tsym);
< prev index next >