diff options
| author | Karen Butzke | 2012-08-08 15:14:07 +0000 |
|---|---|---|
| committer | Karen Butzke | 2012-08-08 15:14:07 +0000 |
| commit | 8e72879c563353eefb7e3ca37ddc56938869536b (patch) | |
| tree | f923f0184533cc6e352822f2c9141fb85ab67aab | |
| parent | 5b09a218ab6aaa1c4b411de320727e795c1e8aa2 (diff) | |
| download | webtools.dali-8e72879c563353eefb7e3ca37ddc56938869536b.tar.gz webtools.dali-8e72879c563353eefb7e3ca37ddc56938869536b.tar.xz webtools.dali-8e72879c563353eefb7e3ca37ddc56938869536b.zip | |
bug 379853 - Improve performance of
BinaryPackageFragment.buildClassFiles()
| -rw-r--r-- | jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragment.java | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragment.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragment.java index cc8623e16f..234c9b857f 100644 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragment.java +++ b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragment.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. + * Copyright (c) 2009, 2012 Oracle. 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 http://www.eclipse.org/legal/epl-v10.html. @@ -60,16 +60,29 @@ final class BinaryPackageFragment for (IJavaElement child : children) { IClassFile jdtClassFile = (IClassFile) child; IType jdtType = jdtClassFile.getType(); - if (BinaryPersistentType.typeIsPersistable(jdtType)) { + if (typeIsRelevant(jdtType)) { JavaResourceClassFile classFile = new BinaryClassFile(this, jdtClassFile, jdtType); - if (classFile.getPersistentType().isAnnotated()) { // we only hold annotated types - result.add(classFile); - } + result.add(classFile); } } return result; } + static boolean typeIsRelevant(IType type) { + if (BinaryPersistentType.typeIsPersistable(type)) { + return typeHasAnyAnnotations(type); // we only hold annotated types + } + return false; + } + + static boolean typeHasAnyAnnotations(IType type) { + try { + return (type.getAnnotations().length > 0); + } + catch (JavaModelException e) { + return false; + } + } // ********** JarResourceNode implementation ********** |
