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

review: refactor(label): remove labelledStatement that was not used #1398

Merged
merged 5 commits into from
Jun 20, 2017

Conversation

tdurieux
Copy link
Collaborator

The property labelledStatement was always equals to null.

Fix #1381

@monperrus
Copy link
Collaborator

What about keeping only the getter getLabelledStatement(), put it @Derived, and look it up dynamically, as done for references?

@tdurieux
Copy link
Collaborator Author

It's nit a so trivial task and this api is buggy since the beginning and nobody complain. I will not spend time on a feature that nobody wants

@monperrus
Copy link
Collaborator

monperrus commented Jun 15, 2017 via email

@surli
Copy link
Collaborator

surli commented Jun 15, 2017

@surli could you have a look at this, thanks?

You mean to review this PR or to implement it as a derived property?

@monperrus
Copy link
Collaborator

monperrus commented Jun 15, 2017 via email

@tdurieux
Copy link
Collaborator Author

you can test this

public static void main(String[] args) {
		label2:
		{
			System.out.println("block");
			if (args.length != 0 && args[0].equals("test")) {
				System.out.println("block after break3");
				break label2;
			}
			if (args.length ==1 && args[0].equals("test")) {
				System.out.println("block after break1");
				break label2;
			}
			System.out.println("block after break");
		}
		sw:
		switch ("f") {
		case "f":
			label:
			do {
				System.out.println("do");
				while (true) {
					for (int i = 0; i < 4; i++) {
						System.out.println("for");
						label2:
						{
							System.out.println("test");
							break label2;
						}
						System.out.println("for 1");
					}
					break;
				}
				break;
			} while (true);
			break;
		}
	}

@INRIA INRIA deleted a comment from spoon-bot Jun 19, 2017
…d Continue should have the same behaviour. Add a new interface.
@monperrus
Copy link
Collaborator

Add a new interface

I'm not sure about this. To be discussed.

@INRIA INRIA deleted a comment from spoon-bot Jun 20, 2017
@INRIA INRIA deleted a comment from spoon-bot Jun 20, 2017
@INRIA INRIA deleted a comment from spoon-bot Jun 20, 2017
@surli surli changed the title refactor(label): remove labelledStatement that was not used review: refactor(label): remove labelledStatement that was not used Jun 20, 2017
@spoon-bot
Copy link
Collaborator

Revapi Analysis results

Old API: fr.inria.gforge.spoon:spoon-core:jar:5.8.0-20170619.224547-48

New API: fr.inria.gforge.spoon:spoon-core:jar:5.8.0-SNAPSHOT

Detected changes: 2.

Change 1

Name Element
Old method T spoon.reflect.code.CtContinue::setLabelledStatement(spoon.reflect.code.CtStatement)
New none
Code java.method.removed
Description Method was removed.
Breaking binary: breaking,

Change 2

Name Element
Old method T spoon.reflect.code.CtBreak::setTargetLabel(java.lang.String)
New method T spoon.reflect.code.CtLabelledFlowBreak::setTargetLabel(java.lang.String) @ spoon.reflect.code.CtBreak
Code java.method.returnTypeChanged
Description The return type changed from 'T extends spoon.reflect.code.CtBreak' to 'T extends spoon.reflect.code.CtLabelledFlowBreak'.
Breaking binary: breaking,

Change 2

Name Element
Old method T spoon.reflect.code.CtBreak::setTargetLabel(java.lang.String)
New method T spoon.reflect.code.CtLabelledFlowBreak::setTargetLabel(java.lang.String) @ spoon.reflect.code.CtBreak
Code java.method.movedToSuperClass
Description The method used to be declared in class 'spoon.reflect.code.CtBreak' but is now declared in superclass 'spoon.reflect.code.CtLabelledFlowBreak'.
Breaking binary: equivalent,

Change 2

Name Element
Old method T spoon.reflect.code.CtBreak::setTargetLabel(java.lang.String)
New method T spoon.reflect.code.CtLabelledFlowBreak::setTargetLabel(java.lang.String) @ spoon.reflect.code.CtBreak
Code java.generics.formalTypeParameterChanged
Description The formal type parameter changed from 'T extends spoon.reflect.code.CtBreak' to 'T extends spoon.reflect.code.CtLabelledFlowBreak'.
Breaking binary: non_breaking,

@monperrus monperrus merged commit 1f6cd87 into INRIA:master Jun 20, 2017
@monperrus
Copy link
Collaborator

thanks @tdurieux @surli

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

Successfully merging this pull request may close these issues.

4 participants