Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

[#149] allow extension fields in java 8 interfaces #1444

Closed
wants to merge 1 commit into from

Conversation

cdietrich
Copy link
Member

[#149] allow extension fields in java 8 interfaces

@szarnekow
Copy link
Contributor

I assume the extensions are available in classes implementing the interface, too

Copy link
Contributor

@szarnekow szarnekow left a comment

Choose a reason for hiding this comment

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

Nice

@cdietrich
Copy link
Member Author

cdietrich commented Jan 21, 2023

I assume the extensions are available in classes implementing the interface, too

didnt test this. do we look up extensions in superclasses? i assume no otherwise api eg in generated inferrer would be easier?

@szarnekow
Copy link
Contributor

I think we consider inherited extensions. It should just work

@cdietrich
Copy link
Member Author

it does not. there is this done?

@szarnekow
Copy link
Contributor

it does not. there is this done?

Hmm for classes I see the equivalent example working fine:

class A {
	public static extension String s;
	def void m1(int i) {
		i.substring();
	}
}
class B extends A {
	def void m2(int i) {
		i.substring();
	}
}

@szarnekow
Copy link
Contributor

And indeed it fails for interfaces:

interface A {
	@Extension
	public static String s;
	def void m1(int i) {
		i.substring();
	}
}
class B implements A {
	def void m2(int i) {
		i.substring(); // error
	}
}

@szarnekow
Copy link
Contributor

org.eclipse.xtext.xbase.typesystem.internal.LogicalContainerAwareReentrantTypeResolver.addExtensionFieldsToMemberSession(ResolvedTypes, IFeatureScopeSession, JvmDeclaredType, JvmIdentifiableElement, Set<String>, Set<JvmType>) is only traversing the extended class with the wrong assumption that interfaces don't define fields.

@cdietrich cdietrich force-pushed the cd_issue149 branch 2 times, most recently from 2c05939 to 397f3b6 Compare February 17, 2023 14:19
@cdietrich cdietrich modified the milestones: Release_2.30, Release_2.31 Feb 18, 2023
@cdietrich
Copy link
Member Author

replaced with eclipse-xtext/xtext#2591

@cdietrich cdietrich closed this Apr 18, 2023
@cdietrich cdietrich deleted the cd_issue149 branch April 18, 2023 09:06
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants