-
Notifications
You must be signed in to change notification settings - Fork 33
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
Change ImageLoader importing #105
base: 4.7
Are you sure you want to change the base?
Change ImageLoader importing #105
Conversation
This change is required to allow a call to Object.factory to work as intended. For such calls to work, D needs to know about the module (i.e. the symbol needs to be resolvable). This specific change is in relation to a change that will happen in the FileFormat class which will create a child of FileFormat dynamically.
Thinking out loud: would it be better to add a
Cyclic dependencies are caused by module constructors. I had a quick glance at the module constructor in |
I'd be happy with that. I only chose
Sorry, not entirely sure what you mean by this. What counts as part of the module constructor? |
A module constructor is declared using dwt/org.eclipse.swt.gtk.linux.x86/src/org/eclipse/swt/internal/image/JPEGFileFormat.d Line 152 in c811a5e
|
Ah, okay. I didn't realise a While I'd be (mostly) fine moving the code out, I thought the general idea was to keep the code as close to Java as possible? The local fix I have does this — the main part being that |
There's no semantic difference of placing a
Yes, but correctness first. I was thinking this issue was in the correctness category. But, of course, it can be solved in different ways. |
This will add a
.all
fororg.eclipse.swt.internal.image
, which is then imported by theImageLoader
class.As I've mentioned in #103 and #104, when attempting to add a new constructor to the
Image
class (specificallyImage(Device, ImageDataProvider)
, I encountered a cyclic dependency betweenDPIUtil
andJPEGFileFormat
.The main cause was in the
FileFormat
class which, in DWT, imports theJPEGFileFormat
class, whereas SWT doesn't.SWT uses
Class.forName
to dynamically create an instance of the file format. I changed DWT to use the same (after implementing theforName
method), but -- sinceFileFormat
couldn't importJPEGFileFormat
-- DWT couldn't resolve the symbol.ImageLoader
is the only place where SWT imports all from theorg.eclipse.swt.internal.image
package, so I changed the import here to be the same. This then made everything work (locally).Edit: (corrected cyclic dependency)
Here is the error that would occur: