+3  A: 

Q1: I think yellow means protected and red means private. The "F" means final.

Q2: That can be done using reflection. Say there is a class C with a private member field pm and you want to access instanceOfC.pm, this is the way to go:

/* exception stuff ommitted (for readability and shortness) */
C instanceOfC = new C();

Class<? extends C> clazz = instanceOfC.getClass();
Field f = clazz.getDeclaredField("pm");
f.setAccessible(true);

... = f.get(instanceOfC);  //<-- this will get you the value of `c.pm`

You should probably read the JavaDoc of Class, Field and Method

Johannes Weiß
+2  A: 

Q1: The F means "final", so, the contents of the field can not be normally modified by direct access with the code. The yellow diamond means that it is a protected field. The red square means that it is a private field. If it was a green circle it would mean that it is public.

Some info on eclipse debugging, which much more than just the legends:

http://www.ibm.com/developerworks/library/os-ecbug/

Q2: You can use reflection to access any field on a class and invoke any method (if the security settings allow you). Reflection is a technique that allows you to "introspect" any class and access the members by name.

There is several tutorials on the web on how to use reflection:

http://java.sun.com/docs/books/tutorial/reflect/

http://java.sun.com/developer/technicalArticles/ALT/Reflection/

Mario Ortegón
Just to clarify, you can change "final" fields through reflection. You can't through the normal language, and the system makes some assumptions about final, but the reflection API can change the values.
Will Hartung
Added a note to it on the response, thanks!
Mario Ortegón
Thanks, some great resources, But if you ever find an Eclipse icon legend I'd appreciate it
Daxon
I was actually looking for it but couldn't find it...
Mario Ortegón
I once asked for them to provide the explanation in a hover, but no. If the icon has an F it is a final, if it has an S it is a static.
Thorbjørn Ravn Andersen
See this site for a list of the icons and their meanings: http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/topic/org.eclipse.jdt.doc.user/reference/ref-156.htm
Rich Seller
+1  A: 

You need to use the Reflection API. With that you can do almost anything you like with those fields.

I won't discuss whether you should or should not access them, just that you can with reflection.

Will Hartung
+1  A: 

you could try using Reflections See this as well.

Atmocreations
+1  A: 

What version of OVal are you using?

I ask because the FieldContext class does have a getField() method:

http://oval.sourceforge.net/api/net/sf/oval/context/FieldContext.html#getField%28%29

The return type is a java.lang.reflect.Field which has a getName() accessor:

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/reflect/Field.html#getName%28%29

So you seem to be trying to re-invent the wheel by using a squared boulder :)

Also, unless you are implementing a generic framework, or you need to implement an emergency hack, you should avoid accessing non-public fields with reflection.

Privates are (meant to be) subject to change within the enclosing class; protected ones are subject to change within the inheritance tree; and package-scoped ones are subject to change vertically. The author of such code does not make any guarantees (syntactically and semantically) if his artifacts are accessed via reflection.

Tying your code to them via reflection is a good way to make it brittle and fragile like a pretty petunia blasted by the winder wind of the Siberian tundra ;)

luis.espinal
+1 for the poetic expression of truth
Michael Borgwardt