WebLogic's EJB 9.2 compiler rejects public method definitions using varargs. It does so in a very weird way: it complains that "transient" is not allowed as a method modifier, which of course it isn't. I wrote this method in my EJB: public void recordRecalculateMarketPricingEvent( RecalculateMarketPricingEvent event, AuditRecordAction...actions) And this was the result at deploy time (XDoclet didn't mind it): <Oct 12, 2006 2:46:19 PM MST> <Debug> <EjbCompilation> <000000> <[EJBCompiler] Compiling EJB sources> /tmp/appcgen_pricing.ear/appcgen_pricing-ejb.jar/com/dte/pricing/ejb/AuditService_ibl70p_Intf.java:21: modifier transient not allowed here public transient void recordRecalculateMarketPricingEvent(com.dte.pricing.events.RecalculateMarketPricingEvent arg0, com.dte.pricing.events.AuditRecordAction[] arg1) Looking at the source that is indeed what WebLogic generated for the public Local Interface: /** package com.dte.pricing.ejb; public void setSessionContext(javax.ejb.SessionContext arg0);
* This code was automatically generated at 3:07:24 PM on Oct 12, 2006
* by weblogic.ejb.container.ejbc.Ejb2Rmi -- do not edit.
*
* @version WebLogic Server 9.2 Fri Jun 23 20:47:26 EDT 2006 783464
* @author Copyright (c) 2006 by BEA Systems, Inc. All Rights Reserved.
*/
import weblogic.ejb.container.interfaces.WLEnterpriseBean;
public interface AuditService_ibl70p_Intf
extends WLEnterpriseBean
{
public void ejbActivate();
public void ejbCreate();
public void ejbPassivate();
public void ejbRemove();
public transient void recordRecalculateMarketPricingEvent(com.dte.pricing.events.RecalculateMarketPricingEvent arg0, com.dte.pricing.events.AuditRecordAction[] arg1)
throws com.dte.shared.persist.PersistenceException;
Somehow WebLogic knows that it is a varargs method and translates it to an array. But for some bizarre reason, it puts transient in front of my method definition, and the AppC compiler rejects it.
Changing my method to this is my only current workaround:
public void recordRecalculateMarketPricingEvent(
RecalculateMarketPricingEvent event, AuditRecordAction[] actions)
WebLogic has no problem with private vararg methods however, presumably because it doesn't touch them. Which means JRockit has no problem with it. This works:
private void printArgs(AuditRecordAction...actions)
This is frustrating. With WebLogic 9.0 and even in 9.1 defining methods with parameterized types as arguments in an EJB would get rejected by the compiler. That is, this would not work:
public void work(List<Product> products)
But this would work:
public void work(List products)
That was finally fixed in WebLogic 9.2. And what was weird about that issue was that you could return parameterized types from a public EJB method in WebLogic 9.0 and 9.1. So this worked fine:
public List<Product> work(String something)
Is the idea that we get more or less one implementation of a new feature in Java 5 with every release of WL? I wonder if we get covariant returns...
Comments