Book a Demo

Author Topic: Java import and access modifiers  (Read 2289 times)

danS

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Java import and access modifiers
« on: May 25, 2005, 07:34:12 am »
I just imported some some Java 5.0 code via Code Engineering->Import Source Directory and found some of the access modifiers to be incorrect:
  • The enum constructor shows up as package accessible (~) when it should be private (-)
  • Interface methods show up as package assessable (~) when they should be public (+)

On an unrelated topic, does anyone know how to turn off the <<property set>> and <<property get>> sterotypes import adds to my accessors and mutators?

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Java import and access modifiers
« Reply #1 on: May 25, 2005, 03:29:03 pm »
The reason EA is setting things to have package assessable scope for Java is because the scope has been omitted in the source code.  In order to round-trip this, EA uses the package scope which has no mapping to Java, to represent the scope being omitted.

I can only think of an indirect way of stopping EA setting the property stereotypes.  EA uses the options for creating properties to determine if a method is a property.  So, to stop it from recognising anything as a property you could change the Get/Set prefixes (Tools | Options | Generation | Java Specifications) to something rediculous.  Something like 'noSettersEver' and 'noGettersEver' seems appropriate.

Having said that though, EA does use those stereotypes that it sets.  For an example, look in the diagram properties and there is an option 'Hide Property Methods'.

Simon

danS

  • EA Novice
  • *
  • Posts: 11
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: Java import and access modifiers
« Reply #2 on: May 26, 2005, 12:56:44 pm »
I can understand the mechanics as to why EA thinks these methods are package assessible, but isn't EA still interpreting the source code incorrectly?