Merge pull request #25 from ming13/fix-readme-formatti

Fix readme formatting
This commit is contained in:
Nathan Sweet 2014-03-15 01:11:55 +01:00
commit 2b2164dea1

View File

@ -62,8 +62,6 @@ Iterate all fields:
for(int i = 0, n = access.getFieldCount(); i < n; i++) {
access.set(instanceObject, i, valueToPut);
}
}
```
## Visibility
@ -74,6 +72,7 @@ ReflectASM can always access public members. An attempt is made to define access
Stack traces when using ReflectASM are a bit cleaner. Here is Java's reflection calling a method that throws a RuntimeException:
```
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
@ -83,12 +82,15 @@ Stack traces when using ReflectASM are a bit cleaner. Here is Java's reflection
Caused by: java.lang.RuntimeException
at com.example.SomeClass.someMethod(SomeClass.java:48)
... 5 more
```
Here is the same but when ReflectASM is used:
```
Exception in thread "main" java.lang.RuntimeException
at com.example.SomeClass.someMethod(SomeClass.java:48)
at com.example.SomeClassMethodAccess.invoke(Unknown Source)
at com.example.SomeCallingCode.doit(SomeCallingCode.java:22)
```
If ReflectASM is used to invoke code that throws a checked exception, the checked exception is thrown. Because it is a compilation error to use try/catch with a checked exception around code that doesn't declare that exception as being thrown, you must catch Exception if you care about catching a checked exception in code you invoke with ReflectASM.