Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

read/write static field = static field ?

 
Himai Minh
Ranch Hand
Posts: 1361
7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Read/write static field is not allowed in EJB. But final static field is allowed, according to chapter 21 Runtime Environment of JSR-318.

I google "read/write static field". But I cannot find a definition of this term.

Does "read/write static field" means static field ?
 
Greg Charles
Sheriff
Posts: 3002
12
Firefox Browser IntelliJ IDE Java Mac Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, it means a non-final static field, also called a class variable. Those are not allowed allowed in EJBs, but static finals are allowed. The intent is to enable defining constants in the EJB code, like a static final String or int. I admit though, you could put a static final mutable object in your EJB and store stuff in there just like you would with non-final static fields. However, that would go against the spirit of the specification.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic