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

[eclipse/xtext#1777] ported xtend code to java #1555

Merged
merged 1 commit into from
Aug 24, 2020
Merged

Conversation

cdietrich
Copy link
Member

[eclipse/xtext#1777] ported xtend code to java
Signed-off-by: Christian Dietrich christian.dietrich@itemis.de

@cdietrich cdietrich added this to the Release_2.23 milestone Aug 9, 2020
@cdietrich cdietrich force-pushed the cd_someMoreX2J branch 8 times, most recently from db412bb to 5fbd457 Compare August 9, 2020 18:59
Signed-off-by: Christian Dietrich <christian.dietrich@itemis.de>
throw new IllegalArgumentException("Invalid class name: " + className);
}
this.packageName = packageName;
this.simpleNames = Arrays.asList(className.split("\\."));
Copy link
Contributor

Choose a reason for hiding this comment

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

this. not needed here, and on the lines 109, 126, 127, 131, and 134.

Copy link
Member Author

Choose a reason for hiding this comment

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

i kept it for consistency with place right next to it where it is needed cause of name clash with parameter

Class<?> xcore = Class.forName("org.eclipse.emf.ecore.xcore.XcoreStandaloneSetup");
xcore.getDeclaredMethod("doSetup", new Class[] {}).invoke(null);
} catch (ClassNotFoundException e) {
LOG.error("Couldn't initialize Xcore support. Is it on the classpath?");
Copy link
Contributor

@nbhusare nbhusare Aug 10, 2020

Choose a reason for hiding this comment

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

"Couldn't initialize Xcore support. Is it on the classpath?"
You might like to change the log message to the following - Couldn't initialize Xcore support. It is possible that the library "org.eclipse.emf.ecore.xcore" is missing from the project classpath.

Copy link
Member Author

Choose a reason for hiding this comment

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

did not want to refactor messages here

Class<?> ecore = Class.forName("org.eclipse.xtext.ecore.EcoreSupportStandaloneSetup");
ecore.getDeclaredMethod("setup", new Class[] {}).invoke(null);
} catch (ClassNotFoundException e) {
LOG.error("Couldn't initialize Ecore support. Is 'org.eclipse.xtext.ecore' on the classpath?");
Copy link
Contributor

Choose a reason for hiding this comment

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

"Couldn't initialize Ecore support. Is 'org.eclipse.xtext.ecore' on the classpath?" -> Couldn't initialize Ecore support. It is possible that the library "org.eclipse.xtext.ecore" is missing from the project classpath.

Copy link
Member Author

Choose a reason for hiding this comment

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

did not want to refactor messages here

Object instance = genModelSupport.getDeclaredConstructor().newInstance();
genModelSupport.getDeclaredMethod("createInjectorAndDoEMFRegistration").invoke(instance);
} catch (ClassNotFoundException e) {
LOG.debug(
Copy link
Contributor

Choose a reason for hiding this comment

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

  1. For CNF, an error message is logged on lines 83, and 98. Here, a debug message is logged
  2. Just to be consistent with other log messages, you might like to change it to - Couldn't initialize Ecore support. It is possible that the library "org.eclipse.xtext.ecore" is missing from the project classpath.

try {
delegate.cleanFolder(it);
} catch (FileNotFoundException e) {
throw Exceptions.sneakyThrow(e);
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume Exceptions.sneakyThrow(e); was used intentionally here.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, your assumption is correct. We could consider throwing a RuntimeIOException though it wouldn't change much.

@cdietrich cdietrich modified the milestones: Release_2.23, Release_2.24 Aug 21, 2020
public abstract class AbstractXtextResourceSetTest extends AbstractResourceSetTest {

@Override
protected abstract XtextResourceSet createEmptyResourceSet();
Copy link
Contributor

Choose a reason for hiding this comment

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

Indentation mixed up?

.appendSegment("foo.livecontainertestlanguage");
barURI = IterableExtensions.head(barProject.getSourceFolders()).getPath().trimSegments(1)
.appendSegment("bar.livecontainertestlanguage");
Map<String, ResourceDescriptionsData> chunks = Collections.unmodifiableMap(CollectionLiterals.newHashMap(
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not a big fan of this newHashMap(Pair(..)) stuff... given this is only a test, I'm ok with it though.

try {
delegate.cleanFolder(it);
} catch (FileNotFoundException e) {
throw Exceptions.sneakyThrow(e);
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, your assumption is correct. We could consider throwing a RuntimeIOException though it wouldn't change much.

@cdietrich cdietrich modified the milestones: Release_2.24, Release_2.23 Aug 24, 2020
@cdietrich cdietrich merged commit 27160af into master Aug 24, 2020
@cdietrich cdietrich deleted the cd_someMoreX2J branch August 24, 2020 07:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants