Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 24D47200B44 for ; Thu, 14 Jul 2016 09:18:38 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 234FC160A52; Thu, 14 Jul 2016 07:18:38 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 54E94160A63 for ; Thu, 14 Jul 2016 09:18:36 +0200 (CEST) Received: (qmail 72983 invoked by uid 500); 14 Jul 2016 07:18:35 -0000 Mailing-List: contact commits-help@struts.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@struts.apache.org Delivered-To: mailing list commits@struts.apache.org Received: (qmail 72974 invoked by uid 99); 14 Jul 2016 07:18:35 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 14 Jul 2016 07:18:35 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 34BE8E383A; Thu, 14 Jul 2016 07:18:35 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lukaszlenart@apache.org To: commits@struts.apache.org Message-Id: <715d08b5bc2549c9b53b2ce0f73783ec@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: struts git commit: WW-4646 Replaces ASM3 with the latest version of ASM5 Date: Thu, 14 Jul 2016 07:18:35 +0000 (UTC) archived-at: Thu, 14 Jul 2016 07:18:38 -0000 Repository: struts Updated Branches: refs/heads/master a31766821 -> 8db9d8352 WW-4646 Replaces ASM3 with the latest version of ASM5 Project: http://git-wip-us.apache.org/repos/asf/struts/repo Commit: http://git-wip-us.apache.org/repos/asf/struts/commit/8db9d835 Tree: http://git-wip-us.apache.org/repos/asf/struts/tree/8db9d835 Diff: http://git-wip-us.apache.org/repos/asf/struts/diff/8db9d835 Branch: refs/heads/master Commit: 8db9d8352f515de2bf714a174bec8f8a9248db0a Parents: a317668 Author: Lukasz Lenart Authored: Thu Jul 14 09:18:19 2016 +0200 Committer: Lukasz Lenart Committed: Thu Jul 14 09:18:19 2016 +0200 ---------------------------------------------------------------------- core/pom.xml | 4 +- .../xwork2/util/finder/DefaultClassFinder.java | 44 +- plugins/java8-support/README.adoc | 11 - plugins/java8-support/pom.xml | 60 -- .../struts2/convention/Java8ClassFinder.java | 572 ------------------- .../convention/Java8ClassFinderFactory.java | 48 -- .../src/main/resources/LICENSE.txt | 174 ------ .../java8-support/src/main/resources/NOTICE.txt | 5 - .../src/main/resources/struts-plugin.xml | 33 -- plugins/java8-support/src/site/site.xml | 57 -- plugins/pom.xml | 1 - pom.xml | 12 +- 12 files changed, 34 insertions(+), 987 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/struts/blob/8db9d835/core/pom.xml ---------------------------------------------------------------------- diff --git a/core/pom.xml b/core/pom.xml index 549bd3c..92e28c0 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -282,11 +282,11 @@ commons-lang3 - asm + org.ow2.asm asm - asm + org.ow2.asm asm-commons http://git-wip-us.apache.org/repos/asf/struts/blob/8db9d835/core/src/main/java/com/opensymphony/xwork2/util/finder/DefaultClassFinder.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/com/opensymphony/xwork2/util/finder/DefaultClassFinder.java b/core/src/main/java/com/opensymphony/xwork2/util/finder/DefaultClassFinder.java index 2e140a7..aed42a8 100644 --- a/core/src/main/java/com/opensymphony/xwork2/util/finder/DefaultClassFinder.java +++ b/core/src/main/java/com/opensymphony/xwork2/util/finder/DefaultClassFinder.java @@ -24,9 +24,10 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.objectweb.asm.AnnotationVisitor; import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; import org.objectweb.asm.FieldVisitor; import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.commons.EmptyVisitor; +import org.objectweb.asm.Opcodes; import java.io.File; import java.io.IOException; @@ -463,17 +464,18 @@ public class DefaultClassFinder implements ClassFinder { } - public class InfoBuildingVisitor extends EmptyVisitor { + public class InfoBuildingVisitor extends ClassVisitor { private Info info; private ClassFinder classFinder; public InfoBuildingVisitor(ClassFinder classFinder) { + super(Opcodes.ASM5); this.classFinder = classFinder; } public InfoBuildingVisitor(Info info, ClassFinder classFinder) { + this(classFinder); this.info = info; - this.classFinder = classFinder; } @Override @@ -516,7 +518,7 @@ public class DefaultClassFinder implements ClassFinder { } private String javaName(String name) { - return (name == null)? null:name.replace('/', '.'); + return (name == null) ? null : name.replace('/', '.'); } @Override @@ -524,7 +526,7 @@ public class DefaultClassFinder implements ClassFinder { AnnotationInfo annotationInfo = new AnnotationInfo(desc); info.getAnnotations().add(annotationInfo); getAnnotationInfos(annotationInfo.getName()).add(info); - return new InfoBuildingVisitor(annotationInfo, classFinder); + return null; } @Override @@ -532,7 +534,7 @@ public class DefaultClassFinder implements ClassFinder { ClassInfo classInfo = ((ClassInfo) info); FieldInfo fieldInfo = new FieldInfo(classInfo, name, desc); classInfo.getFields().add(fieldInfo); - return new InfoBuildingVisitor(fieldInfo, classFinder); + return null; } @Override @@ -540,7 +542,28 @@ public class DefaultClassFinder implements ClassFinder { ClassInfo classInfo = ((ClassInfo) info); MethodInfo methodInfo = new MethodInfo(classInfo, name, desc); classInfo.getMethods().add(methodInfo); - return new InfoBuildingVisitor(methodInfo, classFinder); + return new InfoBuildingMethodVisitor(methodInfo); + } + } + + public class InfoBuildingMethodVisitor extends MethodVisitor { + private Info info; + + public InfoBuildingMethodVisitor() { + super(Opcodes.ASM5); + } + + public InfoBuildingMethodVisitor(Info info) { + this(); + this.info = info; + } + + @Override + public AnnotationVisitor visitAnnotation(String desc, boolean visible) { + AnnotationInfo annotationInfo = new AnnotationInfo(desc); + info.getAnnotations().add(annotationInfo); + getAnnotationInfos(annotationInfo.getName()).add(info); + return null; } @Override @@ -549,14 +572,9 @@ public class DefaultClassFinder implements ClassFinder { List annotationInfos = methodInfo.getParameterAnnotations(param); AnnotationInfo annotationInfo = new AnnotationInfo(desc); annotationInfos.add(annotationInfo); - return new InfoBuildingVisitor(annotationInfo, classFinder); + return null; } } - private static final class DefaultClassnameFilterImpl implements Test { - public boolean test(String className) { - return true; - } - } } http://git-wip-us.apache.org/repos/asf/struts/blob/8db9d835/plugins/java8-support/README.adoc ---------------------------------------------------------------------- diff --git a/plugins/java8-support/README.adoc b/plugins/java8-support/README.adoc deleted file mode 100644 index beae27c..0000000 --- a/plugins/java8-support/README.adoc +++ /dev/null @@ -1,11 +0,0 @@ -= Struts 2 Java 8 Support plugin - -This plugin aims to add support for Java 8 specific features. -As Struts 2 core targets Java 6/7 and some features won't work and they have to be adjusted. -Below is a list of features supported by this plugin - -== Supported Java 8 features -- Lambada expressions in actions when using them with the Convention plugin - -== Installation -Just drop this plugin into `WEB-INF/lib` folder or add it as Maven dependency http://git-wip-us.apache.org/repos/asf/struts/blob/8db9d835/plugins/java8-support/pom.xml ---------------------------------------------------------------------- diff --git a/plugins/java8-support/pom.xml b/plugins/java8-support/pom.xml deleted file mode 100644 index fff06fb..0000000 --- a/plugins/java8-support/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - 4.0.0 - - - org.apache.struts - struts2-plugins - 2.5.3-SNAPSHOT - - - struts2-java8-support-plugin - jar - Struts 2 Java 8 support plugin - - - - - org.apache.felix - maven-bundle-plugin - true - - - org.apache.struts2.osgi.StrutsActivator - META-INF - - - - - - - - - - org.apache.struts - struts2-core - - - asm - asm - - - asm - asm-commons - - - - - org.ow2.asm - asm - - - org.ow2.asm - asm-commons - - - - - UTF-8 - - http://git-wip-us.apache.org/repos/asf/struts/blob/8db9d835/plugins/java8-support/src/main/java/org/apache/struts2/convention/Java8ClassFinder.java ---------------------------------------------------------------------- diff --git a/plugins/java8-support/src/main/java/org/apache/struts2/convention/Java8ClassFinder.java b/plugins/java8-support/src/main/java/org/apache/struts2/convention/Java8ClassFinder.java deleted file mode 100644 index 28ad3ec..0000000 --- a/plugins/java8-support/src/main/java/org/apache/struts2/convention/Java8ClassFinder.java +++ /dev/null @@ -1,572 +0,0 @@ -/* - * Copyright 2002-2003,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.struts2.convention; - -import com.opensymphony.xwork2.ActionContext; -import com.opensymphony.xwork2.FileManager; -import com.opensymphony.xwork2.FileManagerFactory; -import com.opensymphony.xwork2.XWorkException; -import com.opensymphony.xwork2.util.finder.ClassFinder; -import com.opensymphony.xwork2.util.finder.ClassLoaderInterface; -import com.opensymphony.xwork2.util.finder.Test; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.LogManager; -import org.apache.commons.lang3.StringUtils; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.FieldVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.lang.annotation.Annotation; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.net.JarURLConnection; -import java.net.URL; -import java.net.URLDecoder; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.jar.JarEntry; -import java.util.jar.JarInputStream; - -/** - * Copy of {@link com.opensymphony.xwork2.util.finder.DefaultClassFinder} with proper support for Java8 - */ -public class Java8ClassFinder implements ClassFinder { - - private static final Logger LOG = LogManager.getLogger(Java8ClassFinder.class); - - private final Map> annotated = new HashMap>(); - private final Map classInfos = new LinkedHashMap(); - - private final List classesNotLoaded = new ArrayList(); - - private boolean extractBaseInterfaces; - private ClassLoaderInterface classLoaderInterface; - private FileManager fileManager; - - public Java8ClassFinder(ClassLoaderInterface classLoaderInterface, Collection urls, boolean extractBaseInterfaces, Set protocols, Test classNameFilter) { - this.classLoaderInterface = classLoaderInterface; - this.extractBaseInterfaces = extractBaseInterfaces; - this.fileManager = ActionContext.getContext().getInstance(FileManagerFactory.class).getFileManager(); - - List classNames = new ArrayList(); - for (URL location : urls) { - try { - if (protocols.contains(location.getProtocol())) { - classNames.addAll(jar(location)); - } else if ("file".equals(location.getProtocol())) { - try { - // See if it's actually a jar - URL jarUrl = new URL("jar", "", location.toExternalForm() + "!/"); - JarURLConnection juc = (JarURLConnection) jarUrl.openConnection(); - juc.getJarFile(); - classNames.addAll(jar(jarUrl)); - } catch (IOException e) { - classNames.addAll(file(location)); - } - } - } catch (Exception e) { - LOG.error("Unable to read URL [{}]", location.toExternalForm(), e); - } - } - - for (String className : classNames) { - try { - if (classNameFilter.test(className)) - readClassDef(className); - } catch (Throwable e) { - LOG.error("Unable to read class [{}]", className, e); - } - } - } - - public Java8ClassFinder(Class... classes){ - this(Arrays.asList(classes)); - } - - public Java8ClassFinder(List classes){ - this.classLoaderInterface = null; - List infos = new ArrayList(); - List packages = new ArrayList(); - for (Class clazz : classes) { - - Package aPackage = clazz.getPackage(); - if (aPackage != null && !packages.contains(aPackage)){ - infos.add(new PackageInfo(aPackage)); - packages.add(aPackage); - } - - ClassInfo classInfo = new ClassInfo(clazz, this); - infos.add(classInfo); - classInfos.put(classInfo.getName(), classInfo); - for (Method method : clazz.getDeclaredMethods()) { - infos.add(new MethodInfo(classInfo, method)); - } - - for (Constructor constructor : clazz.getConstructors()) { - infos.add(new MethodInfo(classInfo, constructor)); - } - - for (Field field : clazz.getDeclaredFields()) { - infos.add(new FieldInfo(classInfo, field)); - } - } - - for (Info info : infos) { - for (AnnotationInfo annotation : info.getAnnotations()) { - List annotationInfos = getAnnotationInfos(annotation.getName()); - annotationInfos.add(info); - } - } - } - - public ClassLoaderInterface getClassLoaderInterface() { - return classLoaderInterface; - } - - public boolean isAnnotationPresent(Class annotation) { - List infos = annotated.get(annotation.getName()); - return infos != null && !infos.isEmpty(); - } - - public List getClassesNotLoaded() { - return Collections.unmodifiableList(classesNotLoaded); - } - - public List findAnnotatedPackages(Class annotation) { - classesNotLoaded.clear(); - List packages = new ArrayList(); - List infos = getAnnotationInfos(annotation.getName()); - for (Info info : infos) { - if (info instanceof PackageInfo) { - PackageInfo packageInfo = (PackageInfo) info; - try { - Package pkg = packageInfo.get(); - // double check via proper reflection - if (pkg.isAnnotationPresent(annotation)) { - packages.add(pkg); - } - } catch (ClassNotFoundException e) { - classesNotLoaded.add(packageInfo.getName()); - } - } - } - return packages; - } - - public List findAnnotatedClasses(Class annotation) { - classesNotLoaded.clear(); - List classes = new ArrayList(); - List infos = getAnnotationInfos(annotation.getName()); - for (Info info : infos) { - if (info instanceof ClassInfo) { - ClassInfo classInfo = (ClassInfo) info; - try { - Class clazz = classInfo.get(); - // double check via proper reflection - if (clazz.isAnnotationPresent(annotation)) { - classes.add(clazz); - } - } catch (Throwable e) { - LOG.error("Error loading class [{}]", classInfo.getName(), e); - classesNotLoaded.add(classInfo.getName()); - } - } - } - return classes; - } - - public List findAnnotatedMethods(Class annotation) { - classesNotLoaded.clear(); - List seen = new ArrayList(); - List methods = new ArrayList(); - List infos = getAnnotationInfos(annotation.getName()); - for (Info info : infos) { - if (info instanceof MethodInfo && !"".equals(info.getName())) { - MethodInfo methodInfo = (MethodInfo) info; - ClassInfo classInfo = methodInfo.getDeclaringClass(); - - if (seen.contains(classInfo)) continue; - - seen.add(classInfo); - - try { - Class clazz = classInfo.get(); - for (Method method : clazz.getDeclaredMethods()) { - if (method.isAnnotationPresent(annotation)) { - methods.add(method); - } - } - } catch (Throwable e) { - LOG.error("Error loading class [{}]", classInfo.getName(), e); - classesNotLoaded.add(classInfo.getName()); - } - } - } - return methods; - } - - public List findAnnotatedConstructors(Class annotation) { - classesNotLoaded.clear(); - List seen = new ArrayList(); - List constructors = new ArrayList(); - List infos = getAnnotationInfos(annotation.getName()); - for (Info info : infos) { - if (info instanceof MethodInfo && "".equals(info.getName())) { - MethodInfo methodInfo = (MethodInfo) info; - ClassInfo classInfo = methodInfo.getDeclaringClass(); - - if (seen.contains(classInfo)) continue; - - seen.add(classInfo); - - try { - Class clazz = classInfo.get(); - for (Constructor constructor : clazz.getConstructors()) { - if (constructor.isAnnotationPresent(annotation)) { - constructors.add(constructor); - } - } - } catch (Throwable e) { - LOG.error("Error loading class [{}]", classInfo.getName(), e); - classesNotLoaded.add(classInfo.getName()); - } - } - } - return constructors; - } - - public List findAnnotatedFields(Class annotation) { - classesNotLoaded.clear(); - List seen = new ArrayList(); - List fields = new ArrayList(); - List infos = getAnnotationInfos(annotation.getName()); - for (Info info : infos) { - if (info instanceof FieldInfo) { - FieldInfo fieldInfo = (FieldInfo) info; - ClassInfo classInfo = fieldInfo.getDeclaringClass(); - - if (seen.contains(classInfo)) continue; - - seen.add(classInfo); - - try { - Class clazz = classInfo.get(); - for (Field field : clazz.getDeclaredFields()) { - if (field.isAnnotationPresent(annotation)) { - fields.add(field); - } - } - } catch (Throwable e) { - LOG.error("Error loading class [{}]", classInfo.getName(), e); - classesNotLoaded.add(classInfo.getName()); - } - } - } - return fields; - } - - public List findClassesInPackage(String packageName, boolean recursive) { - classesNotLoaded.clear(); - List classes = new ArrayList(); - for (ClassInfo classInfo : classInfos.values()) { - try { - if (recursive && classInfo.getPackageName().startsWith(packageName)){ - classes.add(classInfo.get()); - } else if (classInfo.getPackageName().equals(packageName)){ - classes.add(classInfo.get()); - } - } catch (Throwable e) { - LOG.error("Error loading class [{}]", classInfo.getName(), e); - classesNotLoaded.add(classInfo.getName()); - } - } - return classes; - } - - public List findClasses(Test test) { - classesNotLoaded.clear(); - List classes = new ArrayList(); - for (ClassInfo classInfo : classInfos.values()) { - try { - if (test.test(classInfo)) { - classes.add(classInfo.get()); - } - } catch (Throwable e) { - LOG.error("Error loading class [{}]", classInfo.getName(), e); - classesNotLoaded.add(classInfo.getName()); - } - } - return classes; - } - - public List findClasses() { - classesNotLoaded.clear(); - List classes = new ArrayList(); - for (ClassInfo classInfo : classInfos.values()) { - try { - classes.add(classInfo.get()); - } catch (Throwable e) { - LOG.error("Error loading class [{}]", classInfo.getName(), e); - classesNotLoaded.add(classInfo.getName()); - } - } - return classes; - } - - private static List getURLs(ClassLoaderInterface classLoader, String[] dirNames) { - List urls = new ArrayList(); - for (String dirName : dirNames) { - try { - Enumeration classLoaderURLs = classLoader.getResources(dirName); - while (classLoaderURLs.hasMoreElements()) { - URL url = classLoaderURLs.nextElement(); - urls.add(url); - } - } catch (IOException ioe) { - LOG.error("Could not read directory [{}]", dirName, ioe); - } - } - - return urls; - } - - private List file(URL location) { - List classNames = new ArrayList(); - File dir = new File(URLDecoder.decode(location.getPath())); - if ("META-INF".equals(dir.getName())) { - dir = dir.getParentFile(); // Scrape "META-INF" off - } - if (dir.isDirectory()) { - scanDir(dir, classNames, ""); - } - return classNames; - } - - private void scanDir(File dir, List classNames, String packageName) { - File[] files = dir.listFiles(); - for (File file : files) { - if (file.isDirectory()) { - scanDir(file, classNames, packageName + file.getName() + "."); - } else if (file.getName().endsWith(".class")) { - String name = file.getName(); - name = name.replaceFirst(".class$", ""); - // Classes packaged in an exploded .war (e.g. in a VFS file system) should not - // have WEB-INF.classes in their package name. - classNames.add(StringUtils.removeStart(packageName, "WEB-INF.classes.") + name); - } - } - } - - private List jar(URL location) throws IOException { - URL url = fileManager.normalizeToFileProtocol(location); - if (url != null) { - InputStream in = url.openStream(); - try { - JarInputStream jarStream = new JarInputStream(in); - return jar(jarStream); - } finally { - in.close(); - } - } else { - LOG.debug("Unable to read [{}]", location.toExternalForm()); - } - return Collections.emptyList(); - } - - private List jar(JarInputStream jarStream) throws IOException { - List classNames = new ArrayList(); - - JarEntry entry; - while ((entry = jarStream.getNextJarEntry()) != null) { - if (entry.isDirectory() || !entry.getName().endsWith(".class")) { - continue; - } - String className = entry.getName(); - className = className.replaceFirst(".class$", ""); - - //war files are treated as .jar files, so takeout WEB-INF/classes - className = StringUtils.removeStart(className, "WEB-INF/classes/"); - - className = className.replace('/', '.'); - classNames.add(className); - } - - return classNames; - } - - private List getAnnotationInfos(String name) { - List infos = annotated.get(name); - if (infos == null) { - infos = new ArrayList(); - annotated.put(name, infos); - } - return infos; - } - - private void readClassDef(String className) { - if (!className.endsWith(".class")) { - className = className.replace('.', '/') + ".class"; - } - try { - URL resource = classLoaderInterface.getResource(className); - if (resource != null) { - try (InputStream in = resource.openStream()) { - ClassReader classReader = new ClassReader(in); - classReader.accept(new InfoBuildingClassVisitor(this), ClassReader.SKIP_DEBUG); - } - } else { - throw new XWorkException("Could not load " + className); - } - } catch (IOException e) { - throw new XWorkException("Could not load " + className, e); - } - - } - - public class InfoBuildingClassVisitor extends ClassVisitor { - private Info info; - private ClassFinder classFinder; - - public InfoBuildingClassVisitor(ClassFinder classFinder) { - super(Opcodes.ASM5); - this.classFinder = classFinder; - } - - public InfoBuildingClassVisitor(Info info, ClassFinder classFinder) { - this(classFinder); - this.info = info; - } - - @Override - public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { - if (name.endsWith("package-info")) { - info = new PackageInfo(javaName(name), classFinder); - } else { - ClassInfo classInfo = new ClassInfo(javaName(name), javaName(superName), classFinder); - - for (String interfce : interfaces) { - classInfo.getInterfaces().add(javaName(interfce)); - } - info = classInfo; - classInfos.put(classInfo.getName(), classInfo); - - if (extractBaseInterfaces) - extractSuperInterfaces(classInfo); - } - } - - private void extractSuperInterfaces(ClassInfo classInfo) { - String superType = classInfo.getSuperType(); - - if (superType != null) { - ClassInfo base = classInfos.get(superType); - - if (base == null) { - //try to load base - String resource = superType.replace('.', '/') + ".class"; - readClassDef(resource); - base = classInfos.get(superType); - } - - if (base != null) { - List interfaces = classInfo.getSuperInterfaces(); - interfaces.addAll(base.getSuperInterfaces()); - interfaces.addAll(base.getInterfaces()); - } - } - } - - private String javaName(String name) { - return (name == null)? null:name.replace('/', '.'); - } - - @Override - public AnnotationVisitor visitAnnotation(String desc, boolean visible) { - AnnotationInfo annotationInfo = new AnnotationInfo(desc); - info.getAnnotations().add(annotationInfo); - getAnnotationInfos(annotationInfo.getName()).add(info); - return null; - } - - @Override - public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { - ClassInfo classInfo = ((ClassInfo) info); - FieldInfo fieldInfo = new FieldInfo(classInfo, name, desc); - classInfo.getFields().add(fieldInfo); - return null; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - ClassInfo classInfo = ((ClassInfo) info); - MethodInfo methodInfo = new MethodInfo(classInfo, name, desc); - classInfo.getMethods().add(methodInfo); - return new InfoBuildingMethodVisitor(methodInfo); - } - } - - public class InfoBuildingMethodVisitor extends MethodVisitor { - private Info info; - - public InfoBuildingMethodVisitor() { - super(Opcodes.ASM5); - } - - public InfoBuildingMethodVisitor(Info info) { - this(); - this.info = info; - } - - @Override - public AnnotationVisitor visitAnnotation(String desc, boolean visible) { - AnnotationInfo annotationInfo = new AnnotationInfo(desc); - info.getAnnotations().add(annotationInfo); - getAnnotationInfos(annotationInfo.getName()).add(info); - return null; - } - - @Override - public AnnotationVisitor visitParameterAnnotation(int param, String desc, boolean visible) { - MethodInfo methodInfo = ((MethodInfo) info); - List annotationInfos = methodInfo.getParameterAnnotations(param); - AnnotationInfo annotationInfo = new AnnotationInfo(desc); - annotationInfos.add(annotationInfo); - return null; - } - } - - private static final class DefaultClassnameFilterImpl implements Test { - public boolean test(String className) { - return true; - } - } -} - http://git-wip-us.apache.org/repos/asf/struts/blob/8db9d835/plugins/java8-support/src/main/java/org/apache/struts2/convention/Java8ClassFinderFactory.java ---------------------------------------------------------------------- diff --git a/plugins/java8-support/src/main/java/org/apache/struts2/convention/Java8ClassFinderFactory.java b/plugins/java8-support/src/main/java/org/apache/struts2/convention/Java8ClassFinderFactory.java deleted file mode 100644 index 1d3feab..0000000 --- a/plugins/java8-support/src/main/java/org/apache/struts2/convention/Java8ClassFinderFactory.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2002-2003,2009 The Apache Software Foundation. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.struts2.convention; - -import com.opensymphony.xwork2.util.finder.ClassFinder; -import com.opensymphony.xwork2.util.finder.ClassFinderFactory; -import com.opensymphony.xwork2.util.finder.ClassLoaderInterface; -import com.opensymphony.xwork2.util.finder.Test; -import org.apache.logging.log4j.Logger; -import org.apache.logging.log4j.LogManager; - -import java.net.URL; -import java.util.Collection; -import java.util.Set; - -public class Java8ClassFinderFactory implements ClassFinderFactory { - - private static final Logger LOG = LogManager.getLogger(Java8ClassFinderFactory.class); - - public Java8ClassFinderFactory() { - try { - LOG.trace("Checking if ASM5 is on the classpath...."); - Class.forName("org.objectweb.asm.MethodVisitor"); - LOG.trace("Proper version of ASM5 is in use!"); - } catch (ClassNotFoundException e) { - LOG.warn("ASM5 is missing or older version is used! If you use Maven, please exclude asm.jar and asm-commons.jar version 3 from xwork!"); - } - } - - public ClassFinder buildClassFinder(ClassLoaderInterface classLoaderInterface, Collection urls, boolean extractBaseInterfaces, Set protocols, Test classNameFilter) { - LOG.debug("Creating new instance of Java8ClassFinder"); - return new Java8ClassFinder(classLoaderInterface, urls, extractBaseInterfaces, protocols, classNameFilter); - } - -} http://git-wip-us.apache.org/repos/asf/struts/blob/8db9d835/plugins/java8-support/src/main/resources/LICENSE.txt ---------------------------------------------------------------------- diff --git a/plugins/java8-support/src/main/resources/LICENSE.txt b/plugins/java8-support/src/main/resources/LICENSE.txt deleted file mode 100644 index dd5b3a5..0000000 --- a/plugins/java8-support/src/main/resources/LICENSE.txt +++ /dev/null @@ -1,174 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. http://git-wip-us.apache.org/repos/asf/struts/blob/8db9d835/plugins/java8-support/src/main/resources/NOTICE.txt ---------------------------------------------------------------------- diff --git a/plugins/java8-support/src/main/resources/NOTICE.txt b/plugins/java8-support/src/main/resources/NOTICE.txt deleted file mode 100644 index bfba90c..0000000 --- a/plugins/java8-support/src/main/resources/NOTICE.txt +++ /dev/null @@ -1,5 +0,0 @@ -Apache Struts -Copyright 2000-2011 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). \ No newline at end of file http://git-wip-us.apache.org/repos/asf/struts/blob/8db9d835/plugins/java8-support/src/main/resources/struts-plugin.xml ---------------------------------------------------------------------- diff --git a/plugins/java8-support/src/main/resources/struts-plugin.xml b/plugins/java8-support/src/main/resources/struts-plugin.xml deleted file mode 100644 index e25cd83..0000000 --- a/plugins/java8-support/src/main/resources/struts-plugin.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - http://git-wip-us.apache.org/repos/asf/struts/blob/8db9d835/plugins/java8-support/src/site/site.xml ---------------------------------------------------------------------- diff --git a/plugins/java8-support/src/site/site.xml b/plugins/java8-support/src/site/site.xml deleted file mode 100644 index 07a667e..0000000 --- a/plugins/java8-support/src/site/site.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - - org.apache.maven.skins - maven-fluido-skin - 1.3.1 - - - Apache Software Foundation - http://www.apache.org/images/asf-logo.gif - http://www.apache.org/ - - - Apache Struts - http://struts.apache.org/img/struts-logo.svg - http://struts.apache.org/ - - - - - - - - - - - - -
-
- Apache Struts, Struts, Apache, the Apache feather logo, and the Apache Struts - project logos are trademarks of The Apache Software Foundation. -
-
- - - http://git-wip-us.apache.org/repos/asf/struts/blob/8db9d835/plugins/pom.xml ---------------------------------------------------------------------- diff --git a/plugins/pom.xml b/plugins/pom.xml index d4baea8..8d52c24 100644 --- a/plugins/pom.xml +++ b/plugins/pom.xml @@ -42,7 +42,6 @@ embeddedjsp gxp jasperreports - java8-support javatemplates jfreechart json http://git-wip-us.apache.org/repos/asf/struts/blob/8db9d835/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index bef1f1a..2b19b55 100644 --- a/pom.xml +++ b/pom.xml @@ -87,7 +87,7 @@ 4.1.6.RELEASE 3.1.10 3.3 - 5.0.2 + 5.1 3.0.5 1.0.6 2.5 @@ -553,16 +553,6 @@ ${asm5.version} - asm - asm - ${asm.version} - - - asm - asm-commons - ${asm.version} - - junit junit 4.12