diff options
author | Walter Harley | 2009-08-18 06:27:02 +0000 |
---|---|---|
committer | Walter Harley | 2009-08-18 06:27:02 +0000 |
commit | 973dd951906f250918cad946f16501aabb85da0b (patch) | |
tree | 3804144e66c2bbd5de74326d7407620f2e61e842 /org.eclipse.jdt.apt.pluggable.core | |
parent | 9eaac7d665ab2785e8869b9e11fcd4dc49d25f41 (diff) | |
download | eclipse.jdt.core-973dd951906f250918cad946f16501aabb85da0b.tar.gz eclipse.jdt.core-973dd951906f250918cad946f16501aabb85da0b.tar.xz eclipse.jdt.core-973dd951906f250918cad946f16501aabb85da0b.zip |
Bug 285838: IdeFilerImpl.CreateXxx should handle null originatingElement
Diffstat (limited to 'org.eclipse.jdt.apt.pluggable.core')
-rw-r--r-- | org.eclipse.jdt.apt.pluggable.core/META-INF/MANIFEST.MF | 2 | ||||
-rw-r--r-- | org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/filer/IdeFilerImpl.java | 31 |
2 files changed, 21 insertions, 12 deletions
diff --git a/org.eclipse.jdt.apt.pluggable.core/META-INF/MANIFEST.MF b/org.eclipse.jdt.apt.pluggable.core/META-INF/MANIFEST.MF index a0537c42c4..10190b48c4 100644 --- a/org.eclipse.jdt.apt.pluggable.core/META-INF/MANIFEST.MF +++ b/org.eclipse.jdt.apt.pluggable.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.jdt.apt.pluggable.core;singleton:=true -Bundle-Version: 1.0.200.qualifier +Bundle-Version: 1.0.300.qualifier Bundle-Activator: org.eclipse.jdt.internal.apt.pluggable.core.Apt6Plugin Bundle-Vendor: %providerName Require-Bundle: org.eclipse.core.runtime, diff --git a/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/filer/IdeFilerImpl.java b/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/filer/IdeFilerImpl.java index 482711797c..2cfca8762f 100644 --- a/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/filer/IdeFilerImpl.java +++ b/org.eclipse.jdt.apt.pluggable.core/src/org/eclipse/jdt/internal/apt/pluggable/core/filer/IdeFilerImpl.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007, 2008 BEA Systems, Inc. + * Copyright (c) 2007 - 2009 BEA Systems, Inc. and others * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -14,6 +14,7 @@ package org.eclipse.jdt.internal.apt.pluggable.core.filer; import java.io.File; import java.io.IOException; +import java.util.Collections; import java.util.HashSet; import java.util.Set; @@ -91,12 +92,17 @@ public class IdeFilerImpl implements Filer { IFile file = getFileFromOutputLocation(location, pkg, relativeName); //TODO: check whether file has already been generated in this run - Set<IFile> parentFiles = new HashSet<IFile>(originatingElements.length); - for (Element elem : originatingElements) { - IFile enclosing = _env.getEnclosingIFile(elem); - if (null != enclosing) { - parentFiles.add(enclosing); + Set<IFile> parentFiles; + if (originatingElements != null && originatingElements.length > 0) { + parentFiles = new HashSet<IFile>(originatingElements.length); + for (Element elem : originatingElements) { + IFile enclosing = _env.getEnclosingIFile(elem); + if (null != enclosing) { + parentFiles.add(enclosing); + } } + } else { + parentFiles = Collections.emptySet(); } return new IdeOutputNonSourceFileObject(_env, file, parentFiles); } @@ -115,11 +121,14 @@ public class IdeFilerImpl implements Filer { throw new IllegalArgumentException("Name is null"); } //TODO: check whether file has already been generated in this run - Set<IFile> parentFiles = new HashSet<IFile>(originatingElements.length); - for (Element elem : originatingElements) { - IFile enclosing = _env.getEnclosingIFile(elem); - if (null != enclosing) { - parentFiles.add(enclosing); + Set<IFile> parentFiles = Collections.emptySet(); + if (originatingElements != null && originatingElements.length > 0) { + parentFiles = new HashSet<IFile>(originatingElements.length); + for (Element elem : originatingElements) { + IFile enclosing = _env.getEnclosingIFile(elem); + if (null != enclosing) { + parentFiles.add(enclosing); + } } } return new IdeOutputJavaFileObject(_env, name, parentFiles); |