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

LPPRINTER_DEFAULTS needs to declare structure members public #834

Closed
matthiasblaesing opened this issue Jul 31, 2017 · 0 comments
Closed

Comments

@matthiasblaesing
Copy link
Member

The com.sun.jna.platform.win32.Winspool$LPPRINTER_DEFAULTS structure is not correctly bound. The members need to be public to be considered as structure members. This error was reported via the mailing list by Eric Hill:

When I include a reference to the LPPRINTER_DEFAULTS structure, I get the following error:

Exception in thread "main" java.lang.Error: Structure.getFieldOrder() on class com.sun.jna.platform.win32.Winspool$LPPRINTER_DEFAULTS returns names ([DesiredAccess, pDatatype, pDevMode]) which do not match declared field names ([pDatatype])
	at com.sun.jna.Structure.getFields(Structure.java:1027)
	at com.sun.jna.Structure.deriveLayout(Structure.java:1172)
	at com.sun.jna.Structure.calculateSize(Structure.java:1097)
	at com.sun.jna.Structure.calculateSize(Structure.java:1049)
	at com.sun.jna.Structure.allocateMemory(Structure.java:403)
	at com.sun.jna.Structure.<init>(Structure.java:194)
	at com.sun.jna.Structure.<init>(Structure.java:182)
	at com.sun.jna.Structure.<init>(Structure.java:169)
	at com.sun.jna.Structure.<init>(Structure.java:161)
	at com.sun.jna.platform.win32.Winspool$LPPRINTER_DEFAULTS.<init>(Winspool.java:511)
	at winnative.RunMe.main(RunMe.java:20)

I looks like pDatatype is declared as public, whereas pDevMode and DesiredAccess are declared as package level. Should the fields be public or should the function work even with the fields declared at package level?

The assessment is correct. All members of a class, that are structure fields need to be public.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant