Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVikas Chandra2020-03-14 09:29:08 +0000
committerVikas Chandra2020-03-14 14:41:33 +0000
commitb565c569ffee1478da224e236a8fa76d1a2ae9b7 (patch)
tree03af7b37cb270b9cad973358c6ffd869df3d6945
parentb05e5982d3d9ede0ffc3f48a117cfa658338db92 (diff)
downloadeclipse.pde.ui-b565c569ffee1478da224e236a8fa76d1a2ae9b7.tar.gz
eclipse.pde.ui-b565c569ffee1478da224e236a8fa76d1a2ae9b7.tar.xz
eclipse.pde.ui-b565c569ffee1478da224e236a8fa76d1a2ae9b7.zip
Bug 561116 - [14] - Since tag support ( error as well as quickfix)Y20200317-0225Y20200316-1300Y20200316-0820Y20200314-1405
for record, field/method addition to record Change-Id: I1d362403910983e00967a7a7e70ad46b6ff61fab Signed-off-by: Vikas Chandra <Vikas.Chandra@in.ibm.com>
-rw-r--r--apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/markers/NodeFinder.java12
-rw-r--r--apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/markers/UpdateSinceTagOperation.java8
-rw-r--r--apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/BaseApiAnalyzer.java8
-rw-r--r--apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/SinceTagChecker.java12
-rw-r--r--apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/scanner/TagScanner.java54
-rw-r--r--pom.xml4
6 files changed, 90 insertions, 8 deletions
diff --git a/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/markers/NodeFinder.java b/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/markers/NodeFinder.java
index ac214b8944..26632c180a 100644
--- a/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/markers/NodeFinder.java
+++ b/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/markers/NodeFinder.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2014 IBM Corporation and others.
+ * Copyright (c) 2008, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -8,6 +8,10 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -23,6 +27,7 @@ import org.eclipse.jdt.core.dom.EnumDeclaration;
import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.Initializer;
import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.RecordDeclaration;
import org.eclipse.jdt.core.dom.TypeDeclaration;
/**
@@ -62,6 +67,10 @@ public class NodeFinder extends ASTVisitor {
}
@Override
+ public boolean visit(RecordDeclaration node) {
+ return visitNode(node);
+ }
+ @Override
public boolean visit(MethodDeclaration node) {
return visitNode(node);
}
@@ -98,6 +107,7 @@ public class NodeFinder extends ASTVisitor {
int end = bodyDeclaration.getLength() - 1 + start;
switch (bodyDeclaration.getNodeType()) {
case ASTNode.TYPE_DECLARATION:
+ case ASTNode.RECORD_DECLARATION:
case ASTNode.ENUM_DECLARATION:
case ASTNode.ANNOTATION_TYPE_DECLARATION:
if (start <= this.position && this.position <= end) {
diff --git a/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/markers/UpdateSinceTagOperation.java b/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/markers/UpdateSinceTagOperation.java
index bd86c8659d..ad9da02326 100644
--- a/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/markers/UpdateSinceTagOperation.java
+++ b/apitools/org.eclipse.pde.api.tools.ui/src/org/eclipse/pde/api/tools/ui/internal/markers/UpdateSinceTagOperation.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2017 IBM Corporation and others.
+ * Copyright (c) 2008, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -8,6 +8,10 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -87,7 +91,7 @@ public class UpdateSinceTagOperation {
// quickfix change
JavaUI.openInEditor(compilationUnit);
}
- ASTParser parser = ASTParser.newParser(AST.JLS10);
+ ASTParser parser = ASTParser.newParser(AST.JLS14);
parser.setSource(compilationUnit);
if (intValue <= 0) {
// try to use the name range of the corresponding element
diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/BaseApiAnalyzer.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/BaseApiAnalyzer.java
index 7a3450575c..7e9591dfd7 100644
--- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/BaseApiAnalyzer.java
+++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/BaseApiAnalyzer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2019 IBM Corporation and others.
+ * Copyright (c) 2008, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -8,6 +8,10 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -879,7 +883,7 @@ public class BaseApiAnalyzer implements IApiAnalyzer {
if (fJavaProject == null) {
return null;
}
- ASTParser parser = ASTParser.newParser(AST.JLS10);
+ ASTParser parser = ASTParser.newParser(AST.JLS14);
parser.setFocalPosition(offset);
parser.setResolveBindings(false);
parser.setSource(root);
diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/SinceTagChecker.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/SinceTagChecker.java
index 2334e144ef..b485dc28fe 100644
--- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/SinceTagChecker.java
+++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/builder/SinceTagChecker.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008, 2013 IBM Corporation and others.
+ * Copyright (c) 2008, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -8,6 +8,10 @@
*
* SPDX-License-Identifier: EPL-2.0
*
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
+ *
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
@@ -28,6 +32,7 @@ import org.eclipse.jdt.core.dom.FieldDeclaration;
import org.eclipse.jdt.core.dom.Initializer;
import org.eclipse.jdt.core.dom.Javadoc;
import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.RecordDeclaration;
import org.eclipse.jdt.core.dom.TagElement;
import org.eclipse.jdt.core.dom.TextElement;
import org.eclipse.jdt.core.dom.TypeDeclaration;
@@ -90,6 +95,11 @@ public class SinceTagChecker extends ASTVisitor {
return visitAbstractTypeDeclaration(node);
}
+ @Override
+ public boolean visit(RecordDeclaration node) {
+ return visitAbstractTypeDeclaration(node);
+ }
+
/**
* @param declaration
* @return
diff --git a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/scanner/TagScanner.java b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/scanner/TagScanner.java
index b7054a7077..3f33e0ded6 100644
--- a/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/scanner/TagScanner.java
+++ b/apitools/org.eclipse.pde.api.tools/src/org/eclipse/pde/api/tools/internal/provisional/scanner/TagScanner.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2015 IBM Corporation and others.
+ * Copyright (c) 2007, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -7,6 +7,9 @@
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
+ * This is an implementation of an early-draft specification developed under the Java
+ * Community Process (JCP) and is made available for testing and evaluation purposes
+ * only. The code is not compatible with any specification of the JCP.
*
* Contributors:
* IBM Corporation - initial API and implementation
@@ -41,6 +44,7 @@ import org.eclipse.jdt.core.dom.MarkerAnnotation;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.Name;
import org.eclipse.jdt.core.dom.PackageDeclaration;
+import org.eclipse.jdt.core.dom.RecordDeclaration;
import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.TagElement;
import org.eclipse.jdt.core.dom.TypeDeclaration;
@@ -275,6 +279,16 @@ public class TagScanner {
return true;
}
+ @Override
+ public boolean visit(RecordDeclaration node) {
+ if (isNotVisible(node.getModifiers())) {
+ return false;
+ }
+ enterType(node.getName());
+ scanTypeJavaDoc(node);
+ return true;
+ }
+
/**
* Scans the JavaDoc of a {@link TypeDeclaration}
*
@@ -323,6 +337,42 @@ public class TagScanner {
}
}
+ void scanTypeJavaDoc(RecordDeclaration node) {
+ Javadoc doc = node.getJavadoc();
+ if (doc != null) {
+ List<TagElement> tags = doc.tags();
+ IApiAnnotations annots = fDescription.resolveAnnotations(fType);
+ int restrictions = annots != null ? annots.getRestrictions() : RestrictionModifiers.NO_RESTRICTIONS;
+ for (TagElement tag : tags) {
+ String tagname = tag.getTagName();
+ if (!JavadocTagManager.ALL_TAGS.contains(tagname)) {
+ continue;
+ }
+ if (JavadocTagManager.TAG_NOREFERENCE.equals(tagname)) {
+ restrictions |= RestrictionModifiers.NO_REFERENCE;
+ }
+
+ int flags = node.getModifiers();
+ if (JavadocTagManager.TAG_NOEXTEND.equals(tagname)) {
+ if (!Flags.isFinal(flags)) {
+ restrictions |= RestrictionModifiers.NO_EXTEND;
+ continue;
+ }
+ }
+ if (JavadocTagManager.TAG_NOINSTANTIATE.equals(tagname)) {
+ if (!Flags.isAbstract(flags)) {
+ restrictions |= RestrictionModifiers.NO_INSTANTIATE;
+ continue;
+ }
+ }
+
+ }
+ if (restrictions != RestrictionModifiers.NO_RESTRICTIONS) {
+ fDescription.setRestrictions(fType, restrictions);
+ }
+ }
+ }
+
@Override
public void endVisit(TypeDeclaration node) {
if (!isNotVisible(node.getModifiers())) {
@@ -610,7 +660,7 @@ public class TagScanner {
*/
public void scan(CompilationUnit source, IApiDescription description, IApiTypeContainer container, Map<String, String> options, IProgressMonitor monitor) throws CoreException {
SubMonitor localmonitor = SubMonitor.convert(monitor, 2);
- ASTParser parser = ASTParser.newParser(AST.JLS10);
+ ASTParser parser = ASTParser.newParser(AST.JLS14);
InputStream inputStream = null;
try {
inputStream = source.getInputStream();
diff --git a/pom.xml b/pom.xml
index 4465752d9c..a7eee116eb 100644
--- a/pom.xml
+++ b/pom.xml
@@ -38,6 +38,10 @@
<profiles>
<profile>
<id>build-individual-bundles</id>
+ <properties>
+ <eclipse-p2-repo.url>http://download.eclipse.org/eclipse/updates/Y-builds</eclipse-p2-repo.url>
+ <skipAPIAnalysis>true</skipAPIAnalysis>
+ </properties>
<repositories>
<repository>
<releases>

Back to the top