Comments (5)
ClassInfo classInfo = env.getClassInfo(cRef); Class<?> c = Class.forName(classInfo.getName());
Thanks for asking. This would get the information about class ClassInfo
, not the class that you're actually looking for. Instead, return the modifiers
from classInfo
itself:
return classInfo.getModifiers();
from jpf-core.
As far as I can tell, JPF currently does not search inner classes (perhaps it should), so we can probably get away with delegating this to Class.getModifiers()
.
The native peer for that method is public int getModifiers____I (MJIEnv env, int clsRef)
.
from jpf-core.
When you say 'search' did you mean the resolving of the classes?. If so, I could confirm that it resolves not just the superclasses and interfaces of a requested class but also its static inner classes (eg: java.lang.String$CaseInsensitiveComparator), and nested interfaces (eg: java.lang.Thread$UncaughtExceptionHandler)
from jpf-core.
Reflection#getClassAccessFlags(java.lang.Class)
is only called about twice for entire test units. I think it is safe to say that the native int getClassAccessFlags(Class<?> c)
is never called with an inner class as the argument c, while running the tests.
I've tried the following implementation:
/**
* NativePeer method for {@link jdk.internal.reflect.Reflection#getClassAccessFlags(java.lang.Class)}
*/
@MJI
public static int getClassAccessFlags__Ljava_lang_Class_2__I(MJIEnv env, int clsObjRef, int cRef) {
try {
ClassInfo classInfo = env.getClassInfo(cRef);
Class<?> c = Class.forName(classInfo.getName());
return c.getModifiers();
} catch (ClassNotFoundException e) {
return MJIEnv.NULL;
}
}
But I'm not quite sure about the following code snippet:
ClassInfo classInfo = env.getClassInfo(cRef);
Class<?> c = Class.forName(classInfo.getName());
Is this the correct approach to retrieve a Class object associated with given class reference (int cRef)
?
from jpf-core.
Yes, I meant the mechanism of searching super classes/interfaces for methods that cannot be found in the current class.
from jpf-core.
Related Issues (20)
- Migration to Java 11 HOT 2
- Coverage configuration HOT 2
- Unit test case performance HOT 10
- Orphan NativePeer method with Java 11.0.20.1 HOT 10
- Gradle build under Gradle 8 has inconsistent configuration HOT 5
- Classpath issue while using JPF(Java Path Finder) HOT 2
- NoClassDefFoundError: sun/misc/SharedSecrets HOT 1
- Build Error occurring when I have the correct version of Java installed? HOT 7
- URLClassLoader unit tests fail under Windows HOT 7
- JPF fails with java.lang.IllegalArgumentException: Null charset name HOT 3
- The wrapper.jar checksum is not consistent with the gradle version. HOT 3
- Cannot build jpf-core due to compileAnnotationsJava FAILED HOT 6
- Class not found: com.google.common.util.concurrent.ThreadFactoryBuilder HOT 1
- Java Path Finder Latest Version not available HOT 1
- Addressing Deprecated API Usage: public static SecurityManager getSecurityManager() {....} has been deprecated since Java 17 HOT 47
- Test case failure at Java-8 branch HOT 6
- `String.equals(Object)` makes JPF on Java 11 crash HOT 9
- Java 17 support: CI configuration, identification of key issues HOT 29
- java.lang.NoSuchMethodError: java.lang.String.getBytes([BIIBI) HOT 13
- cannot find native jdk.internal.misc.CDS.isDumpingClassList0 HOT 43
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jpf-core.