IllegalAccessException after updating 2.1 to 2.2

Greg Brown greg.x.brown at
Mon Aug 20 05:16:26 PDT 2012

> e.g. to have an 'initialise' method, you would call it whatever you want
> ('setupThisController') and just stick the @PostConstruct annotation on it.

This makes sense, though I think it is a bit more flexible than necessary. An FXML controller doesn't generally need more than one "initialize" method, and often does not need any.

> For something that is injected you put the @Injected annotation on it, etc.

Are you referring to @Inject?

If so, this also seems reasonable. Unfortunately, it lives in javax.inject, which is part of Java EE, not SE. I don't think we want to pull all of Java EE in for one annotation. We could duplicate the annotation in FX, but that isn't really ideal either.

> I think I've mentioned this before, but just in case I didn't, for most of
> what FXML does regarding it's controller there are a whole lot of
> pre-existing annotations that I would think make a lot of sense to re-use.

I looked at the list but didn't see much aside from @PostConstruct that would apply to FXML. 

I also didn't see anything that might serve as the equivalent of an @FXML-annotated event handler method. I imagine we'd want something along the lines of a hypothetical "javax.inject.Execute" annotation, so a handler method could be tagged as executable by the loader. 

However, since nothing like this appears to exist, we'd have to create our own. The FXML annotations would then be spread out over three packages:


That's also not ideal.

Maybe the best approach would be to stick with @FXML, but require it on any field or method that will be accessed by FXMLLoader. That's different than the current behavior, but maybe we could provide a flag or system property that could be used to enable the legacy behavior.


More information about the openjfx-dev mailing list