I can't get the ternary statement you provided to compile correctly using 1.4-M1. The error I get is:
The type AbstractChoice<T,E> is not visible Due to the fact that the common ancestor for ListMultipleChoice and ListChoice is the inaccessible package protected object AbstractChoice. This is caused by the behavior of ternary assignment where, if the second and third operands are of different reference types, then it must be possible to convert one of the types to the other type (call this latter type T) by assignment conversion; the type of the conditional expression is T. It is a compile-time error if neither type is assignment compatible with the other type. This is copied verbatim from http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.h tml#290293 Casting one of the new statements to FormComponent allows the statement to compile and run without error for me: FormComponent o = false ? (FormComponent) new ListMultipleChoice("", new Model(), Collections.EMPTY_LIST, (IChoiceRenderer) null) : new ListChoice("", new Model(), Collections.EMPTY_LIST, (IChoiceRenderer) null).setNullValid(true); I imagine it may correct the runtime error you are seeing too. -----Original Message----- From: Martin Makundi [mailto:[EMAIL PROTECTED] Sent: Sunday, May 18, 2008 3:56 AM To: users@wicket.apache.org Subject: Re: Wicket java.lang.IllegalAccessError bug? Yap. If you rephrase it into ifs (or change ternary false state into true) it works fine. ** Martin 2008/5/18 Johan Compagner <[EMAIL PROTECTED]>: > I have no idea what could cause that suddenly in 1.4 > Maybe something that java 5 source compiler does? > But a simple if works fine? > > On 5/17/08, Martin Makundi <[EMAIL PROTECTED]> wrote: >> Hi! >> >> I just upgraded from 1.3.1 to 1.4-m1 and I received the strangest of errors. >> >> Has anyone had the same experience below? This occurs only with the >> ternary operator, probably because both elements get initialized at >> runtime: >> >> public class AnyPage extends WebPage { >> >> public AnyPage() { >> // I wanted to use a ternary operator to choose between rendering >> a listchoice or a multiplelistchoice. >> // This worked in 1.3.1 but not in 1.4-m1 anymore. The JVM used is >> 1.6.0_04 with jetty 6.1.0 >> >> // .... >> >> Object o = false >> ? new ListMultipleChoice("", >> new Model(), Collections.EMPTY_LIST, (IChoiceRenderer) null) >> : new ListChoice("", >> new Model(), Collections.EMPTY_LIST, (IChoiceRenderer) >> null).setNullValid(true); >> >> // .... >> } >> } >> >> Throws a nasty exception: >> >> 2008-05-17 16:57:23,531 67447 [btpool0-8] ERROR RequestCycle - Can't >> instantiate page using constructor public wicket.quickstart.AnyPage() >> org.apache.wicket.WicketRuntimeException: Can't instantiate page using >> constructor public wicket.quickstart.AnyPage() >> at >> org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory. java:168) >> at >> org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory. java:58) >> at >> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget .newPage(BookmarkablePageRequestTarget.java:262) >> at >> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget .getPage(BookmarkablePageRequestTarget.java:283) >> at >> org.apache.wicket.request.target.component.BookmarkablePageRequestTarget .processEvents(BookmarkablePageRequestTarget.java:210) >> at >> org.apache.wicket.request.AbstractRequestCycleProcessor.processEvents(Ab stractRequestCycleProcessor.java:91) >> at >> org.apache.wicket.RequestCycle.processEventsAndRespond(RequestCycle.java :1174) >> at org.apache.wicket.RequestCycle.step(RequestCycle.java:1251) >> at org.apache.wicket.RequestCycle.steps(RequestCycle.java:1352) >> at org.apache.wicket.RequestCycle.request(RequestCycle.java:499) >> at >> org.apache.wicket.protocol.http.WicketFilter.doGet(WicketFilter.java:375 ) >> at >> org.apache.wicket.protocol.http.WicketServlet.doGet(WicketServlet.java:1 24) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) >> at >> wicket.quickstart.SessionLeakWorkaroundServlet.service(SessionLeakWorkar ound.java:57) >> at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) >> at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:491) >> at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:367) >> at >> org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:1 85) >> at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:181) >> at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:689) >> at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:391) >> at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:139) >> at org.mortbay.jetty.Server.handle(Server.java:285) >> at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:457) >> at >> org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConne ction.java:751) >> at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:500) >> at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:209) >> at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:357) >> at >> org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.jav a:217) >> at >> org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.ja va:442) >> Caused by: java.lang.reflect.InvocationTargetException >> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) >> at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source) >> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown >> Source) >> at java.lang.reflect.Constructor.newInstance(Unknown Source) >> at >> org.apache.wicket.session.DefaultPageFactory.newPage(DefaultPageFactory. java:149) >> ... 29 more >> Caused by: java.lang.IllegalAccessError: tried to access class >> org.apache.wicket.markup.html.form.AbstractChoice from class >> wicket.quickstart.AnyPage >> at wicket.quickstart.AnyPage.<init>(AnyPage.java:69) >> ... 34 more >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ______________ The information contained in this message is proprietary and/or confidential. If you are not the intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, please be aware that any message addressed to our domain is subject to archiving and review by persons other than the intended recipient. Thank you. _____________ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]