Re: A basic question about constants. A final field that is not final?
- From: Richard <grin@xxxxxxxx>
- Date: Sun, 24 Jul 2005 10:47:34 +0200
Hello,
1. Thanks for all your answers. Actually, final has been removed in the source code in src.zip but it is not removed in the online javadoc at http://java.sun.com/j2se/1.5.0/docs/api/index.html, and, worse, the field of the binary version (for Windows) is final yet (see the following compilation). I have submited a bug report to Sun.
2. I have another problem with CachedRowSetImpl (implementation of CachedRowSet by Sun). Do you know if I can get the source code of this implementation of CachedRowSet? It is not in src.zip.
* My java version:
java -version java version "1.5.0_03" Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_03-b07) Java HotSpot(TM) Client VM (build 1.5.0_03-b07, mixed mode, sharing)
* An example that does not compile and shows that the constant is final:
import javax.sql.rowset.CachedRowSet;
public abstract class AClass2 implements CachedRowSet {
static {
COMMIT_ON_ACCEPT_CHANGES = false;
} public static boolean getConstant() {
return COMMIT_ON_ACCEPT_CHANGES;
}
}class Main {
public static void main(String[] args) {
System.out.println(AClass2.getConstant());
}
}javac AClass2.java
AClass2.java:5: cannot assign a value to final variable COMMIT_ON_ACCEPT_CHANGES
COMMIT_ON_ACCEPT_CHANGES = false;
^
1 error
Regards,
Richard
Sebastian Scheid a écrit :
"Richard" <grin@xxxxxxxx> schrieb im Newsbeitrag news:42e1fbdb$0$29943$636a15ce@xxxxxxxxxxxxxxx
Hello,
An extract from the javadoc of javax.sql.rowset.CachedRowSet (an interface):
---
COMMIT_ON_ACCEPT_CHANGES
static final boolean COMMIT_ON_ACCEPT_CHANGES
Causes the CachedRowSet object's SyncProvider to commit the changes when acceptChanges() is called. If set to false, the changes will not be committed until one of the CachedRowSet interface transaction methods is called.
See Also: commit(), rollback(), Constant Field Values ---
My basic question is: how is it possible to change the value of a constant defined in an interface?
The interface is in the SDK since 5.0 I think. And in 5.0 the field is not final in the sources as well as in the api-doc. What lib with the interface are you using?
Regards
Sebastian
.
- Follow-Ups:
- References:
- A basic question about constants
- From: Richard
- Re: A basic question about constants
- From: Sebastian Scheid
- A basic question about constants
- Prev by Date: Re: A basic question about constants
- Next by Date: Re: Drawing translucent masks
- Previous by thread: Re: A basic question about constants
- Next by thread: Re: A basic question about constants. A final field that is not final?
- Index(es):
Relevant Pages
|
|