Author: struberg Date: Sun Jan 20 18:20:54 2013 New Revision: 1435908 URL: http://svn.apache.org/viewvc?rev=1435908&view=rev Log: OWB-344 fix Interceptor proxy for package private classes
Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageInjectionPointOwner.java openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageMethodInjectionPointOwner.java - copied, changed from r1435892, openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MethodInjectionPointOwner.java Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/InjectionPointInjectionTest.java Modified: openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java?rev=1435908&r1=1435907&r2=1435908&view=diff ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java (original) +++ openwebbeans/trunk/webbeans-impl/src/main/java/org/apache/webbeans/proxy/InterceptorDecoratorProxyFactory.java Sun Jan 20 18:20:54 2013 @@ -223,7 +223,7 @@ public class InterceptorDecoratorProxyFa { try { - Constructor superDefaultCt = classToProxy.getConstructor(null); + Constructor superDefaultCt = classToProxy.getDeclaredConstructor(null); final String descriptor = Type.getConstructorDescriptor(superDefaultCt); final MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "<init>", descriptor, null, null); Modified: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/InjectionPointInjectionTest.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/InjectionPointInjectionTest.java?rev=1435908&r1=1435907&r2=1435908&view=diff ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/InjectionPointInjectionTest.java (original) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/InjectionPointInjectionTest.java Sun Jan 20 18:20:54 2013 @@ -36,7 +36,8 @@ import org.junit.Test; public class InjectionPointInjectionTest extends AbstractUnitTest { @Test - public void testInjectionPointInjection() { + public void testInjectionPointInjection() + { Collection<Class<?>> beanClasses = new ArrayList<Class<?>>(); beanClasses.add(ConstructorInjectionPointOwner.class); beanClasses.add(FieldInjectionPointOwner.class); @@ -64,4 +65,14 @@ public class InjectionPointInjectionTest shutDownContainer(); } + + @Test + public void testPackagePrivateInjectionPoint() + { + startContainer(PackageMethodInjectionPointOwner.class, PackageInjectionPointOwner.class); + + PackageInjectionPointOwner pipo = getInstance(PackageInjectionPointOwner.class); + assertThat(pipo, is(notNullValue())); + assertThat(pipo.getName(), is("pimp")); + } } Added: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageInjectionPointOwner.java URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageInjectionPointOwner.java?rev=1435908&view=auto ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageInjectionPointOwner.java (added) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageInjectionPointOwner.java Sun Jan 20 18:20:54 2013 @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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.webbeans.newtests.injection.injectionpoint.tests; + +import javax.inject.Inject; + +/** + * Package private injection point owner + */ +class PackageInjectionPointOwner +{ + @Inject + private PackageMethodInjectionPointOwner pimp; + + public String getName() + { + return pimp.getName(); + } +} Copied: openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageMethodInjectionPointOwner.java (from r1435892, openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MethodInjectionPointOwner.java) URL: http://svn.apache.org/viewvc/openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageMethodInjectionPointOwner.java?p2=openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageMethodInjectionPointOwner.java&p1=openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MethodInjectionPointOwner.java&r1=1435892&r2=1435908&rev=1435908&view=diff ============================================================================== --- openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/beans/MethodInjectionPointOwner.java (original) +++ openwebbeans/trunk/webbeans-impl/src/test/java/org/apache/webbeans/newtests/injection/injectionpoint/tests/PackageMethodInjectionPointOwner.java Sun Jan 20 18:20:54 2013 @@ -13,12 +13,17 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.webbeans.newtests.injection.injectionpoint.beans; +package org.apache.webbeans.newtests.injection.injectionpoint.tests; import javax.enterprise.inject.spi.InjectionPoint; import javax.inject.Inject; -public class MethodInjectionPointOwner extends AbstractInjectionPointOwner { +import org.apache.webbeans.newtests.injection.injectionpoint.beans.AbstractInjectionPointOwner; + +/** + * Attention, this class is only package private! + */ +class PackageMethodInjectionPointOwner extends AbstractInjectionPointOwner { @Inject public void setInjectionPoint(InjectionPoint ip) {