Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 234023 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/api/tools/model/tests/TagScannerTests.java (-3 / +3 lines)
Lines 79-85 Link Here
79
	 */
79
	 */
80
	protected void doScan(String name, IApiDescription manifest, IClassFileContainer cfc) {
80
	protected void doScan(String name, IApiDescription manifest, IClassFileContainer cfc) {
81
		try {
81
		try {
82
			TagScanner.newScanner().scan(getCompilationUnit(name), manifest, cfc);
82
			TagScanner.newScanner().scan(getCompilationUnit(name), manifest, cfc, null);
83
		}
83
		}
84
		catch(CoreException e) {
84
		catch(CoreException e) {
85
			fail(MessageFormat.format("Error scanning: {0}", new String[] {name}));
85
			fail(MessageFormat.format("Error scanning: {0}", new String[] {name}));
Lines 93-99 Link Here
93
	 */
93
	 */
94
	protected void doScan(String name, IApiDescription manifest) {
94
	protected void doScan(String name, IApiDescription manifest) {
95
		try {
95
		try {
96
			TagScanner.newScanner().scan(getCompilationUnit(name), manifest, null);
96
			TagScanner.newScanner().scan(getCompilationUnit(name), manifest, null, null);
97
		}
97
		}
98
		catch(CoreException e) {
98
		catch(CoreException e) {
99
			fail(MessageFormat.format("Error scanning: {0}", new String[] {name}));
99
			fail(MessageFormat.format("Error scanning: {0}", new String[] {name}));
Lines 152-158 Link Here
152
		};
152
		};
153
		IApiDescription manifest = newDescription();
153
		IApiDescription manifest = newDescription();
154
		try { 
154
		try { 
155
			TagScanner.newScanner().scan(getCompilationUnit("a/b/c/TestMethod10.java"), manifest, container);
155
			TagScanner.newScanner().scan(getCompilationUnit("a/b/c/TestMethod10.java"), manifest, container, null);
156
		} catch (CoreException e) {
156
		} catch (CoreException e) {
157
			return;
157
			return;
158
		}
158
		}
(-)src_ant/org/eclipse/pde/api/tools/internal/tasks/ApiFileGeneratorTask.java (-1 / +6 lines)
Lines 30-35 Link Here
30
import org.apache.tools.ant.BuildException;
30
import org.apache.tools.ant.BuildException;
31
import org.apache.tools.ant.Task;
31
import org.apache.tools.ant.Task;
32
import org.eclipse.core.runtime.CoreException;
32
import org.eclipse.core.runtime.CoreException;
33
import org.eclipse.jdt.core.JavaCore;
33
import org.eclipse.osgi.util.ManifestElement;
34
import org.eclipse.osgi.util.ManifestElement;
34
import org.eclipse.pde.api.tools.internal.ApiDescription;
35
import org.eclipse.pde.api.tools.internal.ApiDescription;
35
import org.eclipse.pde.api.tools.internal.ApiSettingsXmlVisitor;
36
import org.eclipse.pde.api.tools.internal.ApiSettingsXmlVisitor;
Lines 167-173 Link Here
167
					System.out.println("Unit name[" + i + "] : " + unit.getName()); //$NON-NLS-1$ //$NON-NLS-2$
168
					System.out.println("Unit name[" + i + "] : " + unit.getName()); //$NON-NLS-1$ //$NON-NLS-2$
168
				}
169
				}
169
				try {
170
				try {
170
					tagScanner.scan(unit, apiDescription, classFileContainer);
171
					//default to highest, since we have no EE context
172
					//TODO should use EE context to resolve a compliance level
173
					Map options = JavaCore.getOptions();
174
					options.put(JavaCore.COMPILER_COMPLIANCE, JavaCore.VERSION_1_6);
175
					tagScanner.scan(unit, apiDescription, classFileContainer, options);
171
				} catch (CoreException e) {
176
				} catch (CoreException e) {
172
					ApiPlugin.log(e);
177
					ApiPlugin.log(e);
173
				}
178
				}
(-)src/org/eclipse/pde/api/tools/internal/provisional/scanner/TagScanner.java (-4 / +24 lines)
Lines 24-29 Link Here
24
import org.eclipse.core.runtime.IStatus;
24
import org.eclipse.core.runtime.IStatus;
25
import org.eclipse.core.runtime.NullProgressMonitor;
25
import org.eclipse.core.runtime.NullProgressMonitor;
26
import org.eclipse.core.runtime.Status;
26
import org.eclipse.core.runtime.Status;
27
import org.eclipse.jdt.core.ICompilationUnit;
27
import org.eclipse.jdt.core.JavaCore;
28
import org.eclipse.jdt.core.JavaCore;
28
import org.eclipse.jdt.core.Signature;
29
import org.eclipse.jdt.core.Signature;
29
import org.eclipse.jdt.core.dom.AST;
30
import org.eclipse.jdt.core.dom.AST;
Lines 461-467 Link Here
461
	private TagScanner() {}
462
	private TagScanner() {}
462
	
463
	
463
	/**
464
	/**
464
	 * Scans the specified source {@linkplain CompilationUnit} for contributed API javadoc tags.
465
	 * Scans the specified source {@linkplain CompilationUnit} for contributed API Javadoc tags.
465
	 * Tags on methods will have unresolved signatures.
466
	 * Tags on methods will have unresolved signatures.
466
	 * 
467
	 * 
467
	 * @param source the source file to scan for tags
468
	 * @param source the source file to scan for tags
Lines 469-488 Link Here
469
	 * @throws CoreException
470
	 * @throws CoreException
470
	 */
471
	 */
471
	public void scan(CompilationUnit source, IApiDescription description) throws CoreException {
472
	public void scan(CompilationUnit source, IApiDescription description) throws CoreException {
472
		scan(source, description, null);
473
		scan(source, description, null, null);
474
	}
475
	
476
	/**
477
	 * Scans the specified {@link ICompilationUnit} for contributed API Javadoc tags.
478
	 * Tags on methods will have unresolved signatures.
479
	 * @param unit the compilation unit source
480
	 * @param description the API description to annotate with any new tag rules found
481
	 * @param container optional class file container containing the class file for the given source
482
	 * 	that can be used to resolve method signatures if required (for tags on methods). If 
483
	 * 	not provided (<code>null</code>), method signatures will be unresolved.
484
	 * @throws CoreException
485
	 */
486
	public void scan(ICompilationUnit unit, IApiDescription description, IClassFileContainer container) throws CoreException {
487
		scan(new CompilationUnit(unit), description, container, unit.getJavaProject().getOptions(true));
473
	}
488
	}
474
	
489
	
475
	/**
490
	/**
476
	 * Scans the specified source {@linkplain CompilationUnit} for contributed API javadoc tags.
491
	 * Scans the specified source {@linkplain CompilationUnit} for contributed API javadoc tags.
492
	 * Tags on methods will have unresolved signatures.
477
	 * 
493
	 * 
478
	 * @param source the source file to scan for tags
494
	 * @param source the source file to scan for tags
479
	 * @param description the API description to annotate with any new tag rules found
495
	 * @param description the API description to annotate with any new tag rules found
480
	 * @param container optional class file container containing the class file for the given source
496
	 * @param container optional class file container containing the class file for the given source
481
	 * 	that can be used to resolve method signatures if required (for tags on methods). If 
497
	 * 	that can be used to resolve method signatures if required (for tags on methods). If 
482
	 * 	not provided (<code>null</code>), method signatures will be unresolved.
498
	 * 	not provided (<code>null</code>), method signatures will be unresolved.
499
	 * @param options a map of Java compiler options to use when creating the AST to scan
500
	 * 
483
	 * @throws CoreException 
501
	 * @throws CoreException 
484
	 */
502
	 */
485
	public void scan(CompilationUnit source, IApiDescription description, IClassFileContainer container) throws CoreException {
503
	public void scan(CompilationUnit source, IApiDescription description, IClassFileContainer container, Map options) throws CoreException {
486
		ASTParser parser = ASTParser.newParser(AST.JLS3);
504
		ASTParser parser = ASTParser.newParser(AST.JLS3);
487
		InputStream inputStream = null;
505
		InputStream inputStream = null;
488
		try {
506
		try {
Lines 506-512 Link Here
506
				}
524
				}
507
			}
525
			}
508
		}
526
		}
509
		Map options = JavaCore.getOptions();
527
		if(options == null) {
528
			options = JavaCore.getOptions();
529
		}
510
		options.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED);
530
		options.put(JavaCore.COMPILER_DOC_COMMENT_SUPPORT, JavaCore.ENABLED);
511
		parser.setCompilerOptions(options);
531
		parser.setCompilerOptions(options);
512
		org.eclipse.jdt.core.dom.CompilationUnit cunit = (org.eclipse.jdt.core.dom.CompilationUnit) parser.createAST(new NullProgressMonitor());
532
		org.eclipse.jdt.core.dom.CompilationUnit cunit = (org.eclipse.jdt.core.dom.CompilationUnit) parser.createAST(new NullProgressMonitor());
(-)src/org/eclipse/pde/api/tools/internal/PluginProjectApiComponent.java (-7 / +5 lines)
Lines 196-213 Link Here
196
		}
196
		}
197
		TagScanner scanner = TagScanner.newScanner();
197
		TagScanner scanner = TagScanner.newScanner();
198
		Iterator iterator = sourceRoots.iterator();
198
		Iterator iterator = sourceRoots.iterator();
199
		ICompilationUnit[] units = null;
200
		IJavaElement[] pkgs = null;
199
		while (iterator.hasNext()) {
201
		while (iterator.hasNext()) {
200
			IPackageFragmentRoot root = (IPackageFragmentRoot) iterator.next();
202
			pkgs = ((IPackageFragmentRoot) iterator.next()).getChildren();
201
			IJavaElement[] pkgs = root.getChildren();
202
			for (int i = 0; i < pkgs.length; i++) {
203
			for (int i = 0; i < pkgs.length; i++) {
203
				if (pkgs[i] instanceof IPackageFragment) {
204
				if (pkgs[i] instanceof IPackageFragment) {
204
					IPackageFragment pkg = (IPackageFragment) pkgs[i];
205
					units = ((IPackageFragment) pkgs[i]).getCompilationUnits();
205
					ICompilationUnit[] units = pkg.getCompilationUnits();
206
					for (int j = 0; j < units.length; j++) {
206
					for (int j = 0; j < units.length; j++) {
207
						ICompilationUnit unit = units[j];
208
						CompilationUnit cu = new CompilationUnit(unit.getResource().getLocation().toOSString());
209
						try {
207
						try {
210
							scanner.scan(cu, apiDescription, this);
208
							scanner.scan(units[j], apiDescription, this);
211
						} catch (CoreException e) {
209
						} catch (CoreException e) {
212
							abort("Unable to initialize from Javadoc tags", e); //$NON-NLS-1$
210
							abort("Unable to initialize from Javadoc tags", e); //$NON-NLS-1$
213
						}
211
						}
(-)src/org/eclipse/pde/api/tools/internal/ProjectApiDescription.java (-1 / +1 lines)
Lines 227-233 Link Here
227
							restrictions = RestrictionModifiers.NO_RESTRICTIONS;
227
							restrictions = RestrictionModifiers.NO_RESTRICTIONS;
228
							fTimeStamp = resource.getModificationStamp();
228
							fTimeStamp = resource.getModificationStamp();
229
							try {
229
							try {
230
								TagScanner.newScanner().scan(new CompilationUnit(unit), ProjectApiDescription.this,
230
								TagScanner.newScanner().scan(unit, ProjectApiDescription.this,
231
									getClassFileContainer((IPackageFragmentRoot) fType.getPackageFragment().getParent()));
231
									getClassFileContainer((IPackageFragmentRoot) fType.getPackageFragment().getParent()));
232
							} catch (CoreException e) {
232
							} catch (CoreException e) {
233
								ApiPlugin.log(e.getStatus());
233
								ApiPlugin.log(e.getStatus());

Return to bug 234023