Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsafe field access #39

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Kumonda221-CrO3
Copy link

Added field access by sun.misc.Unsafe.

@@ -572,5 +574,25 @@ static private MethodVisitor insertThrowExceptionForFieldType (MethodVisitor mv,
mv.visitInsn(ATHROW);
return mv;
}


static public FieldAccess getAccessUnsafe(Class<?> type)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer new FieldAccessUnsafe(Class) over putting unsafe related code in FieldAccess.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All right.And thanks for your notice! I'll try to improve it. Would you like me to write an inner-class in FieldAccess?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unsafe would need to be completely separate and accessed in a way that still works when unsafe is not available. However, with unsafe being unsupported in future Java versions, I'm not sure it's worth it.

@NathanSweet NathanSweet changed the title ReflectASM Unsafe field access Jun 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants