[arquillian-issues] [JBoss JIRA] Created: (ARQAJO-27) Reduce overusage of static imports

Karel Piwko (JIRA) jira-events at lists.jboss.org
Wed Feb 23 03:16:25 EST 2011


Reduce overusage of static imports
----------------------------------

                 Key: ARQAJO-27
                 URL: https://issues.jboss.org/browse/ARQAJO-27
             Project: Arquillian Ajocado
          Issue Type: Bug
    Affects Versions: 1.0.0.Alpha1
            Reporter: Karel Piwko
            Assignee: Lukas Fryc


It is extremely difficult to follow and read the code overfilled with static imports especially when reading the code without an IDE.
The main reason why static imports exist is to make code more readable not the opposite.

See guideline at http://download.oracle.com/javase/1.5.0/docs/guide/language/static-import.html

For instance, see SystemPropertiesConfiguration:

import static org.jboss.arquillian.ajocado.utils.URLUtils.buildUrl; (used twice)
import static java.lang.System.getProperty; (used a lot of time, but I don't consider statically importing System as a good practice either)
import static org.jboss.arquillian.ajocado.utils.PrimitiveUtils.*; (I have no idea what is imported from there, I guess methods like asBoolean(String))

Suggestion:
a getPropertyAs(Class<?> clazz, String value, String default)  method can easily encapsulate calls to System.getProperty() and asType wrappers.





--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the arquillian-issues mailing list