Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionStatusDialog.java')
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionStatusDialog.java271
1 files changed, 138 insertions, 133 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionStatusDialog.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionStatusDialog.java
index 376b6124cef..ebb391a7073 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionStatusDialog.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/dialogs/SelectionStatusDialog.java
@@ -31,165 +31,170 @@ import org.eclipse.ui.internal.MessageLine;
/**
* An abstract base class for dialogs with a status bar and ok/cancel buttons.
- * The status message must be passed over as StatusInfo object and can be
- * an error, warning or ok. The OK button is enabled or disabled depending
- * on the status.
+ * The status message must be passed over as StatusInfo object and can be an
+ * error, warning or ok. The OK button is enabled or disabled depending on the
+ * status.
*
* @since 2.0
*/
public abstract class SelectionStatusDialog extends SelectionDialog {
- private MessageLine fStatusLine;
-
- private IStatus fLastStatus;
-
- private Image fImage;
-
- private boolean fStatusLineAboveButtons = false;
-
- /**
- * Creates an instance of a <code>SelectionStatusDialog</code>.
- * @param parent
- */
- public SelectionStatusDialog(Shell parent) {
- super(parent);
- }
-
- /**
- * Controls whether status line appears to the left of the buttons (default)
- * or above them.
- *
- * @param aboveButtons if <code>true</code> status line is placed above buttons; if
- * <code>false</code> to the right
- */
- public void setStatusLineAboveButtons(boolean aboveButtons) {
- fStatusLineAboveButtons = aboveButtons;
- }
-
- /**
- * Sets the image for this dialog.
- * @param image the image.
- */
- public void setImage(Image image) {
- fImage = image;
- }
-
- /**
- * Returns the first element from the list of results. Returns <code>null</code>
- * if no element has been selected.
- *
- * @return the first result element if one exists. Otherwise <code>null</code> is
- * returned.
- */
- public Object getFirstResult() {
- Object[] result = getResult();
- if (result == null || result.length == 0) {
+ private MessageLine fStatusLine;
+
+ private IStatus fLastStatus;
+
+ private Image fImage;
+
+ private boolean fStatusLineAboveButtons = false;
+
+ /**
+ * Creates an instance of a <code>SelectionStatusDialog</code>.
+ *
+ * @param parent
+ */
+ public SelectionStatusDialog(Shell parent) {
+ super(parent);
+ }
+
+ /**
+ * Controls whether status line appears to the left of the buttons (default) or
+ * above them.
+ *
+ * @param aboveButtons if <code>true</code> status line is placed above buttons;
+ * if <code>false</code> to the right
+ */
+ public void setStatusLineAboveButtons(boolean aboveButtons) {
+ fStatusLineAboveButtons = aboveButtons;
+ }
+
+ /**
+ * Sets the image for this dialog.
+ *
+ * @param image the image.
+ */
+ public void setImage(Image image) {
+ fImage = image;
+ }
+
+ /**
+ * Returns the first element from the list of results. Returns <code>null</code>
+ * if no element has been selected.
+ *
+ * @return the first result element if one exists. Otherwise <code>null</code>
+ * is returned.
+ */
+ public Object getFirstResult() {
+ Object[] result = getResult();
+ if (result == null || result.length == 0) {
return null;
}
- return result[0];
- }
-
- /**
- * Sets a result element at the given position.
- * @param position
- * @param element
- */
- protected void setResult(int position, Object element) {
- Object[] result = getResult();
- result[position] = element;
- setResult(Arrays.asList(result));
- }
-
- /**
- * Compute the result and return it.
- */
- protected abstract void computeResult();
-
- @Override
+ return result[0];
+ }
+
+ /**
+ * Sets a result element at the given position.
+ *
+ * @param position
+ * @param element
+ */
+ protected void setResult(int position, Object element) {
+ Object[] result = getResult();
+ result[position] = element;
+ setResult(Arrays.asList(result));
+ }
+
+ /**
+ * Compute the result and return it.
+ */
+ protected abstract void computeResult();
+
+ @Override
protected void configureShell(Shell shell) {
- super.configureShell(shell);
- if (fImage != null) {
+ super.configureShell(shell);
+ if (fImage != null) {
shell.setImage(fImage);
}
- }
-
- /**
- * Update the dialog's status line to reflect the given status. It is safe to call
- * this method before the dialog has been opened.
- * @param status
- */
- protected void updateStatus(IStatus status) {
- fLastStatus = status;
- if (fStatusLine != null && !fStatusLine.isDisposed()) {
- updateButtonsEnableState(status);
- fStatusLine.setErrorStatus(status);
- }
- }
-
- /**
- * Update the status of the ok button to reflect the given status. Subclasses
- * may override this method to update additional buttons.
- * @param status
- */
- protected void updateButtonsEnableState(IStatus status) {
- Button okButton = getOkButton();
- if (okButton != null && !okButton.isDisposed()) {
+ }
+
+ /**
+ * Update the dialog's status line to reflect the given status. It is safe to
+ * call this method before the dialog has been opened.
+ *
+ * @param status
+ */
+ protected void updateStatus(IStatus status) {
+ fLastStatus = status;
+ if (fStatusLine != null && !fStatusLine.isDisposed()) {
+ updateButtonsEnableState(status);
+ fStatusLine.setErrorStatus(status);
+ }
+ }
+
+ /**
+ * Update the status of the ok button to reflect the given status. Subclasses
+ * may override this method to update additional buttons.
+ *
+ * @param status
+ */
+ protected void updateButtonsEnableState(IStatus status) {
+ Button okButton = getOkButton();
+ if (okButton != null && !okButton.isDisposed()) {
okButton.setEnabled(!status.matches(IStatus.ERROR));
}
- }
+ }
- @Override
+ @Override
protected void okPressed() {
- computeResult();
- super.okPressed();
- }
+ computeResult();
+ super.okPressed();
+ }
- @Override
+ @Override
public void create() {
- super.create();
- if (fLastStatus != null) {
+ super.create();
+ if (fLastStatus != null) {
updateStatus(fLastStatus);
}
- }
+ }
- @Override
+ @Override
protected Control createButtonBar(Composite parent) {
- Font font = parent.getFont();
- Composite composite = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- if (!fStatusLineAboveButtons) {
- layout.numColumns = 2;
- }
- layout.marginHeight = 0;
- layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
- layout.marginWidth = 0;
- composite.setLayout(layout);
- composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- composite.setFont(font);
-
- if (!fStatusLineAboveButtons && isHelpAvailable()) {
- createHelpControl(composite);
- }
- fStatusLine = new MessageLine(composite);
- fStatusLine.setAlignment(SWT.LEFT);
- GridData statusData = new GridData(GridData.FILL_HORIZONTAL);
- fStatusLine.setErrorStatus(null);
- fStatusLine.setFont(font);
- if (fStatusLineAboveButtons && isHelpAvailable()) {
- statusData.horizontalSpan = 2;
- createHelpControl(composite);
- }
- fStatusLine.setLayoutData(statusData);
+ Font font = parent.getFont();
+ Composite composite = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ if (!fStatusLineAboveButtons) {
+ layout.numColumns = 2;
+ }
+ layout.marginHeight = 0;
+ layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
+ layout.marginWidth = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ composite.setFont(font);
+
+ if (!fStatusLineAboveButtons && isHelpAvailable()) {
+ createHelpControl(composite);
+ }
+ fStatusLine = new MessageLine(composite);
+ fStatusLine.setAlignment(SWT.LEFT);
+ GridData statusData = new GridData(GridData.FILL_HORIZONTAL);
+ fStatusLine.setErrorStatus(null);
+ fStatusLine.setFont(font);
+ if (fStatusLineAboveButtons && isHelpAvailable()) {
+ statusData.horizontalSpan = 2;
+ createHelpControl(composite);
+ }
+ fStatusLine.setLayoutData(statusData);
/*
- * Create the rest of the button bar, but tell it not to
- * create a help button (we've already created it).
+ * Create the rest of the button bar, but tell it not to create a help button
+ * (we've already created it).
*/
boolean helpAvailable = isHelpAvailable();
setHelpAvailable(false);
super.createButtonBar(composite);
setHelpAvailable(helpAvailable);
- return composite;
- }
+ return composite;
+ }
}

Back to the top

>tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/FormatterRegressionTests.java9164
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentFormatterUtil.java193
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentTestCase.java114
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/CommentsTestSuite.java31
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/JavaDocTestCase.java703
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/MultiLineTestCase.java204
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/formatter/comment/SingleLineTestCase.java197
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaModelCompletionTests.java167
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaModelTests.java2261
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavaSearchTests.java607
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AbstractJavadocCompletionModelTest.java500
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AccessRestrictionsTests.java1023
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AttachSourceTests.java1141
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/AttachedJavadocTests.java509
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/BindingKeyTests.java227
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/BufferTests.java424
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CancelCounter.java31
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/Canceler.java34
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClassFileTests.java824
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClassNameTests.java1169
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClasspathInitializerTests.java1306
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ClasspathTests.java3032
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeCorrectionTests.java731
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeCorrectionTestsRequestor.java118
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CodeSnippetParsingUtilTests.java124
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompilationUnitTests.java1422
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionContextTests.java3385
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTests.java13665
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTests2.java2416
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTestsRequestor.java193
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionTestsRequestor2.java446
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests.java1415
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests2.java249
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CompletionWithMissingTypesTests_1_5.java569
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ContainerInitializer.java48
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveElementsTests.java2743
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveResourcesTests.java933
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CopyMoveTests.java307
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreateCompilationUnitTests.java341
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreateMembersTests.java144
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/CreatePackageTests.java133
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/DefaultJavaElementComparator.java295
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/DeleteTests.java1009
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/EncodingTests.java918
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ExclusionPatternsTests.java895
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ExistenceTests.java507
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ExternalJarDeltaTests.java541
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/FactoryTests.java232
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/GetSourceTests.java246
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/HierarchyOnWorkingCopiesTests.java102
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/InclusionPatternsTests.java1049
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JSDTModelTests.java244
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaConventionTests.java402
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaElementDeltaTests.java2056
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaModelTests.java564
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaProjectTests.java1133
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaScriptLikeExtensionsTests.java101
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchBugsTests.java7560
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchJavadocTests.java926
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchMultipleProjectsTests.java919
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchScopeTests.java966
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavaSearchTests.java3616
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavadocBugsCompletionModelTest.java1061
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavadocCompletionContextTests.java1587
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavadocFieldCompletionModelTest.java519
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavadocMethodCompletionModelTest.java2584
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavadocPackageCompletionModelTest.java523
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavadocTextCompletionModelTest.java1240
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/JavadocTypeCompletionModelTest.java1343
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/LocalElementTests.java580
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/MementoTests.java678
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ModifyingResourceTests.java347
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/NameLookupTests2.java253
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/NamingConventionTests.java729
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/OptionTests.java632
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/OverflowingCacheTests.java692
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ReconcilerStatementsRecoveryTests.java346
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ReconcilerTests.java3413
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/RenameTests.java875
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ResolveTests.java2113
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/RootManipulationsTests.java1226
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/RunCompletionModelTests.java100
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/RunJavaSearchTests.java78
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SearchParticipantTests.java310
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SearchTests.java1014
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SelectionJavadocModelTests.java1019
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/Semaphore.java65
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SignatureTests.java1024
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SnippetCompletionContextTests.java187
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SnippetCompletionTests.java326
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SnippetCompletionTests_1_5.java67
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SortCompilationUnitElementsTests.java2080
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/SuiteOfTestCases.java122
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TestBuffer.java191
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TestPessimisticProvider.java95
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TestProgressMonitor.java69
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TestvalidationParticipant.java28
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/ThreadSafetyTests.java117
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TypeHierarchyNotificationTests.java1218
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TypeHierarchySerializationTests.java143
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TypeHierarchyTests.java1707
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/TypeResolveTests.java233
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/VariablesInitializer.java48
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/WorkingCopyNotInClasspathTests.java468
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/WorkingCopyOwnerTests.java1331
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/WorkingCopySearchTests.java436
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/model/WorkingCopyTests.java701
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingExpressionsTest.java1229
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingGroupNodeTest.java139
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingInsertBoundTest.java1525
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingJavadocTest.java1062
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingMethodDeclTest.java2180
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingMoveCodeTest.java1892
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingStatementsTest.java3132
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingTest.java229
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingTrackingTest.java524
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/ASTRewritingTypeDeclTest.java1084
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/LineCommentOffsetsTest.java466
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/SourceModifierTest.java149
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/describing/StringAsserts.java153
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/modifying/ASTRewritingModifyingCopyTest.java438
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/modifying/ASTRewritingModifyingInsertTest.java325
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/modifying/ASTRewritingModifyingMoveTest.java488
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/modifying/ASTRewritingModifyingOtherTest.java122
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/modifying/ASTRewritingModifyingRemoveTest.java409
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/modifying/ASTRewritingModifyingReplaceTest.java108
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/rewrite/modifying/ASTRewritingModifyingTest.java208
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/utils/SequenceReaderTests.java84
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/test.xml119
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/.classpath16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/attach.jarbin953 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/attach2.jarbin1051 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/attach2src.zipbin22 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/attachsrc.new.zipbin374 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/attachsrc.zipbin198 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/b153133.jarbin1774 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/full.jarbin1096 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/fullsrc.zipbin797 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/src.zipbin559 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/src/A.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/srcLib/p/X.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/test.jarbin502 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/test2.jarbin1134 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/test4.jarbin1055 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/test4_src.zipbin609 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/test5.jarbin1513 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/test6.jarbin1748 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/test6src.zipbin556 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachSourceTests/update.jarbin783 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/.classpath7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc.zipbin78240 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/allclasses-frame.html52
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/allclasses-noframe.html52
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/constant-values.html142
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/deprecated-list.html142
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/help-doc.html219
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-1.html141
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-10.html144
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-11.html145
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-12.html150
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-13.html141
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-14.html141
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-15.html141
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-2.html156
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-3.html138
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-4.html144
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-5.html141
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-6.html171
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-7.html147
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-8.html141
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index-files/index-9.html138
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/index.html37
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/overview-frame.html46
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/overview-summary.html156
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/overview-tree.html172
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/Annot.D.html224
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/Annot.html235
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/Annot2.html198
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/E.html362
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/TestClass.html221
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/X.A.html230
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/X.B.html224
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/X.html440
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/Z.html258
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/Annot.D.html140
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/Annot.html140
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/Annot2.html140
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/E.html185
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/TestClass.html140
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/X.A.html140
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/X.B.html140
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/X.html140
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/class-use/Z.html140
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/C.html442
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/D.html221
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/class-use/C.html140
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/class-use/D.html201
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/package-frame.html43
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/package-summary.html168
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/package-tree.html154
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/p3/package-use.html166
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/package-frame.html62
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/package-summary.html198
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/package-tree.html166
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p1/p2/package-use.html166
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/X.html254
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/Y.html256
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/Z.html221
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/class-use/X.html176
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/class-use/Y.html140
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/class-use/Z.html184
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/package-frame.html36
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/package-summary.html162
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/package-tree.html151
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/p2/package-use.html172
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/package-list3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/resources/inherit.gifbin57 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/doc/stylesheet.css29
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/lib/test6.jarbin7538 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/lib/test6src.zipbin3083 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/src/p1/p2/X.js68
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/AttachedJavadocProject/src/p1/p2/Y.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/.settings/.jsdtscope7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/lib.jarbin2435 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/libSrc.zipbin1573 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectArgument1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectException1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectException2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectField1.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectField2.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectFieldType3.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectImport3.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariable1.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariableType1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectLocalVariableType2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectMethod1.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectMethod2.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectReturnType1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectReturnType2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperClass1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperClass2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperInterface1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CodeCorrection/src/CorrectSuperInterface2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/.settings/.jsdtscope6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/core/compiler/package.html17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser1.rscbin23054 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser10.rscbin252 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser11.rscbin252 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser12.rscbin252 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser13.rscbin252 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser14.rscbin1204 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser15.rscbin890 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser16.rscbin1866 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser17.rscbin671 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser18.rscbin7979 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser19.rsc2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser2.rscbin21712 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser20.rscbin12598 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser21.rscbin5368 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser3.rscbin1866 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser4.rscbin3126 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser5.rscbin1866 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser6.rscbin866 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser7.rscbin218 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser8.rscbin598 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/parser9.rscbin15800 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/parser/readableNames.properties306
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/problem/messages.properties465
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jdt/internal/compiler/util/messages.properties66
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/core/compiler/CharOperation.js2747
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/core/compiler/IProblem.js983
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/core/compiler/InvalidInputException.js34
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/core/compiler/package.html17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ASTVisitor.js924
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ClassFile.js3040
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/CompilationResult.js433
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/Compiler.js610
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ConfigurableOption.js227
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/DefaultErrorHandlingPolicies.js75
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ICompilerRequestor.js22
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/IDebugRequestor.js42
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/IErrorHandlingPolicy.js28
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/IProblemFactory.js41
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/AND_AND_Expression.js269
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ASTNode.js298
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/AbstractMethodDeclaration.js421
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/AbstractVariableDeclaration.js97
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/AllocationExpression.js317
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Annotation.js38
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/AnnotationTypeDeclaration.js283
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/AnnotationTypeMemberDeclaration.js158
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Argument.js132
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ArrayAllocationExpression.js191
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ArrayInitializer.js209
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ArrayQualifiedTypeReference.js86
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ArrayReference.js213
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ArrayTypeReference.js83
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/AssertStatement.js198
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Assignment.js204
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/BinaryExpression.js1764
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Block.js142
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/BranchStatement.js62
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/BreakStatement.js95
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/CaseStatement.js114
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/CastExpression.js420
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/CharLiteral.js101
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ClassLiteralAccess.js105
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Clinit.js248
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/CompilationUnitDeclaration.js323
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/CompoundAssignment.js158
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ConditionalExpression.js416
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ConstructorDeclaration.js467
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ContinueStatement.js100
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/DoStatement.js173
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/DoubleLiteral.js115
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/EmptyStatement.js64
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/EnumConstant.js208
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/EnumDeclaration.js242
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/EqualExpression.js454
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ExplicitConstructorCall.js366
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Expression.js757
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ExtendedStringLiteral.js79
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/FalseLiteral.js67
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/FieldDeclaration.js242
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/FieldReference.js545
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/FloatLiteral.js117
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ForStatement.js325
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ForeachStatement.js393
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/IfStatement.js242
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ImplicitDocTypeReference.js73
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ImportReference.js82
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Initializer.js120
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/InstanceOfExpression.js105
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/IntLiteral.js150
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/IntLiteralMinValue.js27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Javadoc.js495
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocAllocationExpression.js113
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocArgumentExpression.js98
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocArrayQualifiedTypeReference.js48
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocArraySingleTypeReference.js46
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocFieldReference.js143
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocImportReference.js32
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocMessageSend.js170
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocQualifiedTypeReference.js94
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocReturnStatement.js51
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocSingleNameReference.js58
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/JavadocSingleTypeReference.js94
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/LabeledStatement.js129
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Literal.js57
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/LocalDeclaration.js226
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/LongLiteral.js141
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/LongLiteralMinValue.js27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/MagicLiteral.js29
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/MarkerAnnotation.js42
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/MemberValuePair.js67
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/MessageSend.js399
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/MethodDeclaration.js181
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/NameReference.js64
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/NormalAnnotation.js84
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/NullLiteral.js59
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/NumberLiteral.js36
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/OR_OR_Expression.js272
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/OperatorExpression.js1564
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/OperatorIds.js43
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ParameterizedQualifiedTypeReference.js287
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ParameterizedSingleTypeReference.js217
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/PostfixExpression.js77
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/PrefixExpression.js60
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/QualifiedAllocationExpression.js359
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/QualifiedNameReference.js877
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/QualifiedSuperReference.js63
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/QualifiedThisReference.js120
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/QualifiedTypeReference.js115
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Reference.js70
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ReturnStatement.js244
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/SingleMemberAnnotation.js69
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/SingleNameReference.js689
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/SingleTypeReference.js77
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Statement.js79
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/StringLiteral.js120
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/StringLiteralConcatenation.js79
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/SubRoutineStatement.js67
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/SuperReference.js68
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/SwitchStatement.js320
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/SynchronizedStatement.js194
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ThisReference.js120
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/ThrowStatement.js79
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/TrueLiteral.js70
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/TryStatement.js562
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/TypeDeclaration.js1202
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/TypeParameter.js79
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/TypeReference.js164
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/UnaryExpression.js301
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/WhileStatement.js234
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/ast/Wildcard.js112
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/classfmt/ClassFileConstants.js72
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/classfmt/ClassFileReader.js827
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/classfmt/ClassFileStruct.js188
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/classfmt/ClassFormatException.js131
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/classfmt/FieldInfo.js318
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/classfmt/InnerClassInfo.js142
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/classfmt/MethodInfo.js251
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/AttributeNamesConstants.js25
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/CaseLabel.js81
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/CharArrayCache.js184
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/CodeStream.js5479
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/ConstantPool.js3609
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/DoubleCache.js138
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/ExceptionLabel.js49
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/FieldNameAndTypeCache.js161
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/FloatCache.js138
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/IntegerCache.js155
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/Label.js262
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/LongCache.js155
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/MethodNameAndTypeCache.js162
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/ObjectCache.js152
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/Opcodes.js216
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/codegen/QualifiedNamesConstants.js107
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IBinaryField.js39
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IBinaryMethod.js50
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IBinaryNestedType.js38
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IBinaryType.js114
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/ICompilationUnit.js36
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IConstants.js48
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IDependent.js44
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IGenericField.js27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IGenericMethod.js36
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/IGenericType.js32
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/INameEnvironment.js71
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/ISourceField.js47
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/ISourceImport.js45
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/ISourceMethod.js72
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/ISourceType.js108
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/env/NameEnvironmentAnswer.js79
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/ConditionalFlowInfo.js178
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/ExceptionHandlingFlowContext.js219
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/FinallyFlowContext.js122
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/FlowContext.js493
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/FlowInfo.js144
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/InitializationFlowContext.js97
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/InsideSubRoutineFlowContext.js59
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/LabelFlowContext.js61
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/LoopingFlowContext.js153
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/SwitchFlowContext.js54
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/flow/UnconditionalFlowInfo.js558
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/BooleanConstant.js41
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/ByteConstant.js52
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/CharConstant.js55
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/CompilerOptions.js725
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/Constant.js1611
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/DoubleConstant.js64
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/FloatConstant.js62
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/ITypeRequestor.js37
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/IntConstant.js63
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/LongConstant.js52
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/ReferenceContext.js26
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/ShortConstant.js52
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/impl/StringConstant.js48
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ArrayBinding.js219
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/BaseTypeBinding.js186
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/BaseTypes.js24
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/BinaryTypeBinding.js819
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/Binding.js45
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/BindingIds.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/BlockScope.js825
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ClassScope.js995
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/CompilationUnitScope.js633
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/CompilerModifiers.js42
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/FieldBinding.js228
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ImportBinding.js45
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/InnerEmulationDependency.js22
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/InvocationSite.js28
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/LocalTypeBinding.js177
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/LocalVariableBinding.js110
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/LookupEnvironment.js815
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/MemberTypeBinding.js39
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/MethodBinding.js635
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/MethodScope.js502
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/MethodVerifier.js544
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/MethodVerifier15.js161
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/NestedTypeBinding.js217
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/PackageBinding.js197
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ParameterizedFieldBinding.js59
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ParameterizedGenericMethodBinding.js232
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ParameterizedMethodBinding.js91
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ParameterizedTypeBinding.js787
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ProblemBinding.js55
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ProblemFieldBinding.js41
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ProblemMethodBinding.js42
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ProblemPackageBinding.js32
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ProblemReasons.js28
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ProblemReferenceBinding.js50
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/RawTypeBinding.js170
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/ReferenceBinding.js742
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/Scope.js2887
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/SignatureWrapper.js68
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/SourceTypeBinding.js1162
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/Substitution.js23
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/SyntheticAccessMethodBinding.js307
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/SyntheticArgumentBinding.js61
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/SyntheticFieldBinding.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/TagBits.js61
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/TypeBinding.js289
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/TypeConstants.js89
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/TypeIds.js138
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/TypeVariableBinding.js210
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/UnresolvedReferenceBinding.js70
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/UpdatedMethodBinding.js25
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/VariableBinding.js59
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/lookup/WildcardBinding.js325
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/AbstractCommentParser.js1234
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/JavadocParser.js632
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/NLSLine.js65
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/Parser.js9112
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/ParserBasicInformation.js35
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredBlock.js330
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredElement.js308
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredField.js169
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredImport.js57
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredInitializer.js237
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredLocalVariable.js108
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredMethod.js447
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredStatement.js54
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredType.js511
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/RecoveredUnit.js217
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/Scanner.js3587
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/TerminalTokens.js144
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/diagnose/DiagnoseParser.js2295
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/diagnose/LexStream.js270
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/diagnose/RangeUtil.js200
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser1.rscbin23054 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser10.rscbin252 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser11.rscbin252 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser12.rscbin252 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser13.rscbin252 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser14.rscbin1204 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser15.rscbin890 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser16.rscbin1866 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser17.rscbin671 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser18.rscbin7979 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser19.rsc2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser2.rscbin21712 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser20.rscbin12598 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser21.rscbin5368 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser3.rscbin1866 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser4.rscbin3126 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser5.rscbin1866 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser6.rscbin866 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser7.rscbin218 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser8.rscbin598 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/parser9.rscbin15800 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/parser/readableNames.properties90
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/AbortCompilation.js75
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/AbortCompilationUnit.js29
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/AbortMethod.js29
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/AbortType.js29
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/DefaultProblem.js227
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/DefaultProblemFactory.js197
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/ProblemHandler.js183
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/ProblemReporter.js4731
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/ProblemSeverities.js25
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/ShouldNotImplement.js24
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/problem/messages.properties465
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/CompoundNameVector.js71
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/FloatUtil.js421
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/HashtableOfInt.js92
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/HashtableOfIntValues.js148
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/HashtableOfLong.js92
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/HashtableOfObject.js146
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/HashtableOfPackage.js96
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/HashtableOfType.js96
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/ObjectVector.js132
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/SimpleLookupTable.js156
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/SimpleNameVector.js96
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/SuffixConstants.js43
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/Util.js523
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/WeakHashSet.js206
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Compiler/src/org/eclipse/jsdt/internal/compiler/util/messages.properties66
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/.settings/.jsdtscope15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/ZZZ.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/constructors.jarbin1456 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/constructorssrc.zipbin615 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/generics.jarbin695 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/genericssrc.zipbin265 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/lib.jarbin392 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/pack.jarbin1303 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/same.jarbin535 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/B.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CUWithSecondaryType.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/ClassWithComplexName.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/Completion2InterfacesWithSameMethod.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAfterCase1.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAfterCase2.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAfterSupercall1.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAfterSwitch.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent1.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent4.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAllocationExpressionIsParent5.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName3.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousFieldName4.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousType.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAmbiguousType2.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionArgumentName.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionArrayAccess1.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionArraysCloneMethod.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod1.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod2.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod3.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionAssignmentInMethod4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicField1.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicKeyword1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicLocalVariable1.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicMethod1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicMethodDeclaration1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicPackage1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicPotentialMethodDeclaration1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBasicType1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator1.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator2.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionBinaryOperator3.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionCaseInsensitive.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionCaseInsensitivePackage.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionCastIsParent1.js27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionCastIsParent2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionCatchArgumentName2.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionClassLiteralAfterAnonymousType1.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression1.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression2.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionConditionalExpression3.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionConstructorForAnonymousType.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionDefaultPackage.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionEmptyToken1.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionEmptyTypeName2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionEmptyTypeName3.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionEndOfCompilationUnit.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionExactNameCaseInsensitive.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionExpectedTypeIsNotValid.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer1.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer2.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFieldInitializer4.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFieldName.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindClass2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindException1.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindException2.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindField1.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindField2.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindField3.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindLocalVariable.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindMethod1.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindMethod2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindMethodInProcess.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindMethodInThis.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindSecondaryType1.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionFindThisDotField.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionInsideStaticMethod.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionInstanceofOperator1.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionLocalName.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent1.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent2.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent3.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent4.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent5.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMessageSendIsParent6.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration10.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration6.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration7.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration8.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodDeclaration9.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodThrowsClause.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionMethodThrowsClause2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionNonEmptyToken1.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionNonStaticFieldRelevance.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionNullRequestor.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionObjectsMethodWithInterfaceReceiver.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionOnStaticMember1.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionOnStaticMember2.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionOutOfBounds.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionRepeatedType.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionReturnInInitializer.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionReturnStatementIsParent1.js27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionReturnStatementIsParent2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionSameClass.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionThrowStatement.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionType1.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionUnaryOperator1.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionUnaryOperator2.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedEnclosingType.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedFieldType.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedParameterType.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionUnresolvedReturnType.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer1.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer2.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer3.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInInitializer4.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod1.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod2.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod3.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableInitializerInMethod4.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableName1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableName2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableName3.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVariableNameUnresolvedType.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVisibilityCheck.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionVoidMethod.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/CompletionWithBinaryFolder.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/Default.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/SuperClass.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/SuperInterface.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/TEST_FOO_MyClass.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/Test_Bar_MyClass.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/TypeWithConstructor.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX00.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX01.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX02.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX10.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX11.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX12.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX20.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX21.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/XX22.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/deprecation/Bug127628Type1.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/deprecation/Bug127628Type2.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/org/eclipse/jsdt/core/tests/BasicTestReferences.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/p1/ABC.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/p2/ABC.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/p3/CompletionToplevelType1.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/pack1/PX.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/pack1/pack3/PX.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/pack2/PX.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/q1/CT1.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/q2/CT1.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/z1/z2/Qla1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/z1/z2/qla0/Qla3.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/z1/z2/qla0/Qla4.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/z1/z2/qla0/Wla.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src/z1/z2/qla2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract1.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract10.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract11.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract12.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract13.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract14.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract15.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract16.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract2.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract3.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract4.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract5.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract6.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract7.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract8.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAbstract9.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert5.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordAssert6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak1.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak2.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak3.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak4.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak5.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordBreak6.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase1.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase10.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase2.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase3.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase4.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase5.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase6.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase7.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase8.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCase9.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch1.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch10.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch4.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch5.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch6.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch7.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch8.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordCatch9.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass1.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass10.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass11.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass12.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass13.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass14.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass15.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass16.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass17.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass18.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass19.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass2.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass20.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass21.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass22.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass23.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass24.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass3.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass4.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass5.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass6.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass7.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass8.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordClass9.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue1.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue2.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue3.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordContinue4.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault1.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault10.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault2.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault3.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault4.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault5.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault6.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault7.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault8.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDefault9.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo5.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordDo6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse1.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse4.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse5.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse6.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse7.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordElse8.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends10.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends4.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends5.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends7.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends8.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordExtends9.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse3.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFalse4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal1.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal10.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal11.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal12.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal13.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal14.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal15.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal16.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal17.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal18.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal2.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal3.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal4.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal5.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal6.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal7.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal8.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinal9.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally1.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally10.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally11.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally12.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally13.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally14.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally4.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally5.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally6.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally7.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally8.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFinally9.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor5.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordFor6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf5.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordIf6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements4.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements5.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImplements6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport3.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport4.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport5.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport6.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordImport7.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof3.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof5.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInstanceof6.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface1.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface10.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface11.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface12.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface13.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface14.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface15.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface16.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface17.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface18.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface3.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface4.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface5.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface6.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface7.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface8.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordInterface9.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative4.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative5.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative7.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNative8.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew10.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew11.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew12.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew13.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew14.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew15.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew16.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew3.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew4.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew5.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew6.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew7.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew8.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNew9.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull3.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordNull4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage3.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage4.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage5.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage6.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPackage7.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate10.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate4.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate5.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate7.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate8.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPrivate9.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected10.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected4.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected5.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected7.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected8.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordProtected9.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic1.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic10.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic11.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic12.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic13.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic14.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic15.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic16.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic17.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic18.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic19.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic20.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic3.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic4.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic5.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic6.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic7.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic8.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordPublic9.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn5.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordReturn6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic10.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic4.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic5.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic7.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic8.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStatic9.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp4.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp5.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp7.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordStrictfp8.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper10.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper11.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper4.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper5.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper7.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper8.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSuper9.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch5.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSwitch6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized10.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized11.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized12.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized4.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized5.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized6.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized7.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized8.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordSynchronized9.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis10.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis11.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis12.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis13.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis14.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis4.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis5.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis6.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis7.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis8.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThis9.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow5.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrow6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows1.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows2.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows3.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows4.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows5.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows6.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows7.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordThrows8.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient4.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient5.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient7.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTransient8.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue3.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTrue4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry5.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordTry6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile4.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile5.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile6.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile7.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordVolatile8.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile10.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile5.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile6.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile7.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile8.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/CompletionKeywordWhile9.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordImport2.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordImport8.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordPackage2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src2/p/CompletionKeywordPackage8.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0001/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0002/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0003/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0004/Test.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0009/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0010/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0023/Test.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0024/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0025/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0028/Test.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0030/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0032/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0033/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0034/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0035/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0036/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0037/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0038/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0039/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0048/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0049/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0050/Test.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0057/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0060/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0064/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0067/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0068/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0069/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0070/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0072/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0073/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/src3/test0074/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/test0049.jarbin453 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/test0049src.zipbin209 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/tmpDoc.jarbin550 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/tmpDocDoc.zipbin20791 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/tmpDocsrc.zipbin221 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/zzz.jarbin842 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Completion/zzzsrc.zipbin528 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/.settings/.jsdtscope7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/Hello.js23
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/NO_WORKING.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/Test0157.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/Test0158.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/Test0170.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/Test462.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/X.js0
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/codeManipulation/bug.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/examples.oneofeach/ASTPosterChild.js188
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test000/Test.js36
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test001/Test.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test002/Test.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test003/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test004/Test.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test005/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test006/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test007/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test008/Test.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test009/Test.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test010/Test.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test011/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test012/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test013/Test.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test014/X.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test015/Test.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test100/TestB1.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test100/TestB2.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test100/TestD1.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test100/TestD2.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test101/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test102/TestB1.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test102/TestB2.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test102/TestD1.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test102/TestD2.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test103/Test.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test104/TestD1.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test104/TestD2.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test105/TestB1.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test105/TestB2.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test106/Test.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test107/TestB1.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test107/TestB2.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test107/TestD1.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test107/TestD2.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/test108/Test.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug48489/TestA.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug48489/TestB.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug48489/TestC.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug48489/TestD.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug48489/TestE.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug50898/G.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug50898/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51226/X1.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51226/X2.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51226/X3.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51226/X4.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51226/X5.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51226/X6.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51241/X.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51363/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51476/X1.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51476/X2.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51476/X3.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X1.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X2.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51478/X3.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51508/X.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51600/Test.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51617/Test.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51650/X.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51660/Test.js37
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51770/X.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51911/TestInvalid.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51911/TestValid1.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51911/TestValid2.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug51911/TestValid3.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug52908/X.js47
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug52908/Y.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug52908a/Test.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug52908unicode/X.js47
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug52908unicode/Y.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug53075/X.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug53276/TestA.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug53276/TestB.js23
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug53276/TestC.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug53757/Test.js55
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug54424/Test.js25
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug54776/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug55221/a/Test.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug55221/b/Test.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug55221/c/Test.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug55221/d/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug55223/TestA.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug55223/TestB.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug63044/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug65174/Test.js39
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug65253/Test.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug65253/TestD.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug65288/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68017/TestInvalid.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68017/TestValid.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68017/TestWarn1.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68017/TestWarn2.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68025/TestA.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68025/TestB.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68726/TestBug68726conform1.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68726/TestBug68726conform2.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68726/TestBug68726negative1.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug68726/TestBug68726negative2.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69272/TestClassInvalid.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69272/TestClassValid.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69272/TestFieldInvalid.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69272/TestFieldValid.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69272/TestMethInvalid.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69272/TestMethValid.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69275/TestA.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69275/TestB.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69302/TestInvalid.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69302/TestValid1.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug69302/TestValid2.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug70892/TestInvalid1.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug70892/TestInvalid2.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug70892/TestValid.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug73348/TestInvalid.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug73348/TestValid.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug77644/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug77644/B.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/javadoc/testBug77644/C.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/awtui/AboutDialog.js67
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/awtui/Logo.js53
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/awtui/ProgressBar.js84
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/awtui/TestRunner.js539
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/extensions/ActiveTestSuite.js64
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/extensions/ExceptionTestCase.js46
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/extensions/RepeatedTest.js31
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/extensions/TestDecorator.js38
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/extensions/TestSetup.js37
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/Assert.js291
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/AssertionFailedError.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/ComparisonFailure.js68
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/Protectable.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/Test.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/TestCase.js197
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/TestFailure.js57
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/TestListener.js23
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/TestResult.js166
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/framework/TestSuite.js267
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/BaseTestRunner.js323
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/ClassPathTestCollector.js80
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/FailureDetailView.js23
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/LoadingTestCollector.js69
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/ReloadingTestSuiteLoader.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/SimpleTestCollector.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/Sorter.js38
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/StandardTestSuiteLoader.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/TestCaseClassLoader.js224
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/TestCollector.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/TestRunListener.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/TestSuiteLoader.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/runner/Version.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/AboutDialog.js81
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/CounterPanel.js110
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/DefaultFailureDetailView.js94
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/FailureRunView.js110
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/ProgressBar.js42
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/StatusLine.js42
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/TestHierarchyRunView.js72
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/TestRunContext.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/TestRunView.js37
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/TestRunner.js774
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/TestSelector.js258
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/TestSuitePanel.js159
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/swingui/TestTreeModel.js184
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/textui/ResultPrinter.js138
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/junit/textui/TestRunner.js189
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/p1/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/p2/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/p3/B.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0001/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0002/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0003/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0004/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0005/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0006/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0007/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0008/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0009/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0010/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0011/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0012/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0013/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0014/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0015/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0016/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0017/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0018/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0019/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0020/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0021/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0022/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0023/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0024/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0025/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0026/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0027/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0028/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0029/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0030/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0031/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0032/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0033/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0034/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0035/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0036/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0037/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0038/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0039/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0040/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0041/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0042/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0043/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0044/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0045/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0046/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0047/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0048/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0049/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0050/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0051/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0052/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0053/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0054/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0055/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0056/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0057/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0058/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0059/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0060/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0061/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0062/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0063/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0064/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0065/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0066/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0067/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0068/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0069/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0070/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0071/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0072/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0073/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0074/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0075/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0076/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0077/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0078/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0079/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0080/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0081/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0082/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0083/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0084/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0085/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0086/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0087/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0088/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0089/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0090/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0091/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0092/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0093/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0094/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0095/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0096/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0097/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0098/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0099/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0100/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0101/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0102/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0103/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0104/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0105/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0106/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0107/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0108/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0109/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0110/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0111/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0112/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0113/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0114/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0115/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0116/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0117/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0118/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0119/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0120/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0121/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0122/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0123/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0124/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0125/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0126/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0127/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0128/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0129/Test.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0130/Test.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0131/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0132/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0133/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0134/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0135/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0136/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0137/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0138/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0139/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0140/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0141/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0142/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0143/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0144/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0145/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0146/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0147/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0148/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0149/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0150/Test.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0151/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0152/Test.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0153/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0154/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0155/Test.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0156/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0159/Test.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0160/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0161/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0162/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0163/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0164/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0165/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0166/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0167/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0168/test1/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0169/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0171/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0172/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0173/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0174/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0175/Test.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0176/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0177/Test.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0178/Test.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0179/Test.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0180/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0181/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0182/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0183/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0184/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0185/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0186/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0187/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0188/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0189/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0190/Test.js23
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0191/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0192/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0193/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0194/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0195/Test.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0196/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0197/Test.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0198/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0199/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0200/Test.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0201/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0202/Test.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0203/Test.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0204/Test.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0205/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0206/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0207/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0208/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0209/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0210/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0211/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0212/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0213/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0214/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0215/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0216/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0217/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0218/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0219/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0220/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0221/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0222/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0223/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0224/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0225/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0226/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0227/Test.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0228/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0229/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0230/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0231/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0232/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0233/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0234/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0235/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0236/Test.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0238/Test.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0239/Test.js23
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0240/Test.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0241/Test.js27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0242/Test.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0243/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0244/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0245/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0246/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0247/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0248/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0249/Test.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0250/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0251/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0252/Test.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0253/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0254/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0255/Test.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0256/Test.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0257/Test.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0258/Test.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0259/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0260/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0261/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0262/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0263/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0264/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0265/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0266/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0267/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0268/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0269/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0270/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0271/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0272/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0273/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0274/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0275/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0276/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0277/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0278/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0279/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0280/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0281/Test.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0282/Test.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0283/Test.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0284/Test.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0285/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0286/Test.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0287/Test.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0288/Test.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0289/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0290/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0291/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0292/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0293/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0294/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0295/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0296/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0297/Test.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0298/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0299/Test.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0300/Test.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0301/Test.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0302/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0303/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0304/Test.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0307/Test.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0308/Test.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0309/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0310/Test.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0311/Test.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0312/Test.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0313/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0314/Test.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0315/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0317/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0318/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0319/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0320/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0321/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0322/Test.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0323/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0324/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0325/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0326/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0327/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0328/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0329/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0330/Test.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0331/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0332/LocalSelectionTransfer.js88
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0333/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0334/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0335/ExceptionTestCaseTest.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0336/SorterTest.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0337/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0338/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0339/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0341/A.js29
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0342/Test.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0343/Test.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0344/Test.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0345/A.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0346/Test2.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0347/Test2.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0348/Test2.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0349/Test2.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0350/Test2.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0351/Test2.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0352/Test2.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0353/Test.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0354/Test.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0355/Foo.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0356/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0356/X.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0357/A.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0358/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0359/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0360/X.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0361/X.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0362/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0363/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0364/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0365/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0366/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0367/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0368/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0369/A.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0370/Test.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0371/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0372/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0373/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0374/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0375/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0376/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0377/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0378/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0379/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0380/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0381/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0382/A.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0383/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0384/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0385/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0386/A.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0387/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0388/A.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0389/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0390/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0391/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0392/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0393/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0394/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0395/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0396/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0397/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0398/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0399/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0400/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0401/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0402/A.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0403/A.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0404/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0405/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0406/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0406_a/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0407/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0408/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0409/A.js102
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0410/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0411/A.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0412/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0413/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0414/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0414/B.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0415/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0416/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0417/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0418/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0419/A.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0420/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0421/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0422/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0423/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0424/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0425/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0426/A.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0427/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0428/A.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0429/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0430/A.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0431/A.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0432/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0433/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0434/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0435/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0436/A.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0437/A.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0438/D.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0438_a/W.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0439/C.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0439/E.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0440/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0441/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0442/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0443/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0444/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0445/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0446/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0447/A.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0448/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0449/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0450/A.js22
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0451/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0453/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0454/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0455/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0456/A.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0457/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0458/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0459/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0460/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0461/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0463/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0464/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0465/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0466/Assert.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0467/Assert.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0468/A.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0470/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0471/A.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0473/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0474/A.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0475/A.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0476/A.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0477/A.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0478/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0479/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0480/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0481/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0482/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0483/A.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0484/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0485/A.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0486/A.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0487/A.js27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0488/A.js27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0489/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0490/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0490/B.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0491/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0492/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0493/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0494/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0495/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0496/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0497/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0498/A.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0499/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0500/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0501/JavaEditor.js3243
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0502/A.js28
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0503/A.js27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0504/A.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0505/A.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0506/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0507/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0507/B.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0508/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0509/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0509/B.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0510/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0511/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0512/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0513/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0514/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0515/A.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0516/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0517/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0518/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0519/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0520/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0521/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0522/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0523/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0524/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0525/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0526/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0527/A.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0528/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0529/A.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0530/A.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0531/A.js27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0532/A.js27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0533/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0534/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0535/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0536/A.js505
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0537/A.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0537/B.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0537/C.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0538/A.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0539/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0541/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0541/B.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0542/A.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0543/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0544/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0545/First.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0545/Second.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0545/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0545/Third.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0546/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0547/A.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0548/PaletteStackEditPart.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0549/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0550/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0551/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0552/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0553/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0554/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0554/B.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0555/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0555/B.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0556/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0557/A.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0559/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0560/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0561/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0562/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0563/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0564/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0565/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0566/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0567/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0568/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0569/A.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0570/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0573/X.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0573/Y.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0573/Z.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0574/X.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0575/X.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0578/X.js51
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0579/ParserTask.js91
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0580/DiamondSquareTerrainGenerator.js123
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0582/X.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0595/X.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0595a/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0597/X.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0599/X.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0600/C.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0600/Try.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0602/X.js2890
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0603/X.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0604/X.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0605/X.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0606/X.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0610/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0610/X.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0619/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0629/X.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0630/X.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0631/X.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0653/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0653/X.js22
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0657/A.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Converter/src/test0657/X.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/.settings/.jsdtscope6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/src/A.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/src/A2.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/src/Annot.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/src/E.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/src/E2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/CreateMembers/src/E3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/.classpath8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/src/testBug110576/Test.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/src/testBug66898/Test.js22
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/src/testBug66898b/Test.js22
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/src/testUTF8/Test.js22
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/src/testUTF8BOM/Test.js22
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/testUTF8.jarbin1737 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Encoding/testUTF8.zipbin1038 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/.settings/.jsdtscope6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test001/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test001/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test002/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test002/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test003/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test003/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test004/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test004/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test005/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test005/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test006/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test006/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test007/A_in.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test007/A_out.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test008/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test008/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test009/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test009/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test010/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test010/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test011/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test011/A_out.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test012/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test012/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test013/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test013/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test014/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test014/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test015/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test015/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test016/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test016/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test017/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test017/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test018/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test018/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test019/A_1_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test019/A_1_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test019/A_2_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test019/A_2_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test020/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test020/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test021/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test021/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test022/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test022/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test023/A_in.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test023/A_out.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test024/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test024/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test025/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test025/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test026/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test026/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test027/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test027/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test028/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test028/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test029/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test029/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test030/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test030/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test031/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test031/A_out.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test032/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test032/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test033/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test033/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test034/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test034/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test035/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test035/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test036/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test036/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test037/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test037/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test038/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test038/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test039/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test039/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test040/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test040/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test041/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test041/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test042/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test042/A_out.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test043/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test043/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test044/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test044/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test045/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test045/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test046/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test046/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test047/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test047/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test048/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test048/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test049/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test049/A_out.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test050/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test050/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test051/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test051/A_out.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test052/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test052/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test053/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test053/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test054/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test054/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test055/A_in.js31
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test055/A_out.js32
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test056/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test056/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test057/A_in.js293
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test057/A_out.js289
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test058/A_in.js135
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test058/A_out.js117
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test059/Parser_in.js293
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test059/Parser_out.js289
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test060/Parser_in.js135
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test060/Parser_out.js117
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test061/Parser_in.js135
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test061/Parser_out.js117
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test062/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test062/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test063/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test063/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test064/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test064/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test065/A_in.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test065/A_out.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test066/A_in.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test066/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test067/A_in.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test067/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test068/A_in.js23
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test068/A_out.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test069/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test069/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test070/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test070/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test071/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test071/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test072/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test072/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test073/A_in.js38
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test073/A_out.js31
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test074/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test074/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test075/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test075/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test076/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test076/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test077/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test077/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test078/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test078/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test079/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test079/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test080/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test080/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test081/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test081/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test082/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test082/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test083/A_in.js28
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test083/A_out.js26
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test084/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test084/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test085/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test085/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test086/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test086/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test087/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test087/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test088/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test088/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test089/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test089/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test090/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test090/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test091/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test091/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test092/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test092/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test093/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test093/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test094/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test094/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test095/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test095/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test096/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test096/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test097/A_in.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test097/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test098/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test098/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test099/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test099/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test100/A_in.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test100/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test101/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test101/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test102/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test102/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test103/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test103/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test104/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test104/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test105/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test105/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test106/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test106/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test107/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test107/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test108/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test108/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test109/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test109/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test110/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test110/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test111/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test111/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test112/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test112/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test113/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test113/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test114/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test114/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test115/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test115/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test116/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test116/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test117/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test117/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test118/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test118/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test119/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test119/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test120/A_in.js22
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test120/A_out.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test121/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test121/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test122/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test122/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test123/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test123/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test124/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test124/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test125/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test125/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test126/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test126/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test127/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test127/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test128/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test128/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test129/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test129/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test130/A_in.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test130/A_out.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test131/A_in.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test131/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test132/A_in.js94
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test132/A_out.js94
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test133/A_in.js156
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test133/A_out.js144
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test134/A_in.js142
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test134/A_out.js144
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test135/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test135/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test136/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test136/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test137/A_in.js129
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test137/A_out.js119
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test138/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test138/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test139/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test139/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test140/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test140/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test141/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test141/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test142/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test142/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test143/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test143/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test144/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test144/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test145/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test145/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test146/A_in.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test146/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test147/A_in.js40
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test147/A_out.js37
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test148/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test148/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test149/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test149/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test150/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test150/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test151/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test151/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test152/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test152/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test153/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test153/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test154/A_in.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test154/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test155/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test155/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test156/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test156/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test157/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test157/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test158/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test158/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test159/A_in.js44
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test159/A_out.js44
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test160/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test160/A_out.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test161/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test161/A_out.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test162/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test162/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test163/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test163/A_out.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test164/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test164/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test165/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test165/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test166/A_in.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test166/A_out.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test167/A_in.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test167/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test168/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test168/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test169/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test169/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test170/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test170/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test171/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test171/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test172/A_in.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test172/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test173/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test173/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test174/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test174/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test175/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test175/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test176/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test176/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test177/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test177/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test178/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test178/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test179/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test179/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test180/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test180/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test181/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test181/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test182/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test182/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test183/A_in.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test183/A_out.js29
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test184/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test184/A_out.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test185/A_in.js31
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test185/A_out.js31
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test186/A_in.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test186/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test187/A_in.js380
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test187/A_out.js308
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test188/A_in.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test188/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test189/A_in.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test189/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test190/A_in.js50
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test190/A_out.js52
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test191/A_in.js44
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test191/A_out.js43
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test192/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test192/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test193/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test193/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test194/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test194/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test195/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test195/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test196/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test196/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test197/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test197/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test198/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test198/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test199/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test199/A_out.js22
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test200/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test200/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test201/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test201/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test202/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test202/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test203/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test203/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test204/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test204/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test205/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test205/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test206/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test206/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test207/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test207/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test208/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test208/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test209/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test209/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test210/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test210/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test211/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test211/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test212/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test212/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test213/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test213/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test214/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test214/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test215/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test215/A_out.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test216/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test216/A_out.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test217/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test217/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test218/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test218/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test219/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test219/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test220/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test220/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test221/A_in.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test221/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test222/A_in.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test222/A_out.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test223/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test223/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test224/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test224/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test225/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test225/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test226/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test226/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test227/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test227/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test228/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test228/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test229/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test229/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test230/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test230/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test231/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test231/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test232/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test232/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test233/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test233/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test234/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test234/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test235/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test235/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test236/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test236/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test237/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test237/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test238/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test238/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test239/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test239/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test240/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test240/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test241/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test241/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test242/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test242/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test243/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test243/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test244/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test244/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test245/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test245/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test246/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test246/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test247/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test247/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test248/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test248/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test249/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test249/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test250/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test250/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test251/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test251/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test252/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test252/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test253/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test253/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test254/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test254/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test255/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test255/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test256/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test256/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test257/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test257/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test258/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test258/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test259/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test259/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test260/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test260/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test261/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test261/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test262/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test262/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test263/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test263/A_out.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test264/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test264/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test265/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test265/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test266/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test266/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test267/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test267/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test268/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test268/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test269/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test269/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test270/A_in.js23
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test270/A_out.js23
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test271/A_in.js23
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test271/A_out.js31
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test272/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test272/A_out.js35
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test273/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test273/A_out.js44
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test274/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test274/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test275/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test275/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test276/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test276/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test277/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test277/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test278/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test278/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test279/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test279/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test280/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test280/A_out.js27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test281/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test281/A_out.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test282/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test282/A_out.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test283/A_in.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test283/A_out.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test284/A_in.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test284/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test285/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test285/A_out.js22
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test286/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test286/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test287/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test287/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test288/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test288/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test289/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test289/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test290/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test290/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test291/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test291/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test292/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test292/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test293/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test293/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test294/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test294/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test295/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test295/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test296/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test296/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test297/A_in.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test297/A_out.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test298/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test298/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test299/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test299/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test300/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test300/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test301/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test301/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test302/A_in.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test302/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test303/A_in.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test303/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test304/A_in.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test304/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test305/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test305/A_out.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test306/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test306/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test307/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test307/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test308/A_in.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test308/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test309/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test309/A_out.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test310/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test310/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test311/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test311/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test312/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test312/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test313/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test313/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test314/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test314/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test319/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test319/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test320/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test320/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test321/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test321/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test322/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test322/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test323/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test323/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test324/A_in.js25
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test324/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test325/A_in.js25
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test325/A_out.js23
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test326/A_in.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test326/A_out.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test327/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test327/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test328/A_in.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test328/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test329/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test329/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test330/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test330/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test331/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test331/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test332/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test332/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test333/A_in.js53
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test333/A_out.js55
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test334/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test334/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test335/A_in.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test335/A_out.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test336/A_in.js31
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test336/A_out.js30
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test337/A_in.js339
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test337/A_out.js346
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test338/A_in.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test338/A_out.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test339/A_in.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test339/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test340/A_in.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test340/A_out.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test341/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test341/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test342/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test342/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test343/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test343/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test344/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test344/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test345/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test345/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test346/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test346/A_out.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test347/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test347/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test348/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test348/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test349/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test349/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test350/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test350/A_out.js23
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test351/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test351/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test352/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test352/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test353/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test353/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test354/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test354/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test355/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test355/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test356/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test356/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test357/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test357/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test358/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test358/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test359/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test359/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test360/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test360/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test361/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test361/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test362/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test362/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test363/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test363/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test364/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test364/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test365/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test365/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test366/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test366/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test367/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test367/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test368/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test368/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test369/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test369/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test370/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test370/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test371/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test371/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test372/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test372/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test373/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test373/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test374/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test374/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test375/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test375/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test376/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test376/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test377/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test377/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test378/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test378/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test379/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test379/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test380/A_in.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test380/A_out.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test381/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test381/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test382/A_in.js80
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test382/A_out.js82
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test383/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test383/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test384/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test384/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test385/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test385/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test386/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test386/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test387/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test387/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test388/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test388/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test389/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test389/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test390/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test390/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test391/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test391/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test392/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test392/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test393/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test393/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test394/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test394/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test395/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test395/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test396/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test396/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test397/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test397/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test398/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test398/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test399/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test399/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test400/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test400/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test401/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test401/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test402/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test402/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test403/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test403/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test404/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test404/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test405/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test405/A_out.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test406/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test406/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test407/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test407/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test408/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test408/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test409/A_in.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test409/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test410/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test410/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test411/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test411/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test412/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test412/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test413/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test413/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test414/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test414/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test415/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test415/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test416/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test416/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test417/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test417/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test418/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test418/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test419/A_in.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test419/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test420/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test420/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test421/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test421/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test422/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test422/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test423/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test423/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test424/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test424/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test425/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test425/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test426/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test426/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test427/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test427/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test428/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test428/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test429/A_in.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test429/A_out.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test430/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test430/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test431/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test431/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test432/A_in.js838
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test432/A_out.js839
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test432/formatter.xml159
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test433/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test433/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test434/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test434/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test435/A_in.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test435/A_out.js23
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test436/A_in.js33
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test436/A_out.js34
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test437/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test437/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test437/formatter.xml163
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test438/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test438/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test438/formatter.xml163
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test439/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test439/A_out.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test439/formatter.xml162
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test440/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test440/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test441/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test441/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test442/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test442/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test443/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test443/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test444/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test444/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test445/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test445/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test446/A_in.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test446/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test447/test447.zipbin1852 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test448/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test448/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test449/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test449/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test450/A_in.js0
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test450/A_out.js0
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test451/test451.zipbin2024 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test452/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test452/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test453/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test453/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test454/test454.zipbin1774 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test455/A_in.js49
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test455/A_out.js51
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test456/test456.zipbin1760 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test457/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test457/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test458/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test458/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test459/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test459/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test460/A_in.js31
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test460/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test461/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test461/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test462/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test462/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test462/formatter.xml182
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test463/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test463/A_out.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test464/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test464/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test465/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test465/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test466/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test466/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test467/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test467/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test468/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test468/A_out.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test469/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test469/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test470/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test470/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test471/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test471/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test472/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test472/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test473/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test473/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test474/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test474/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test475/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test475/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test476/A_in.js30
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test476/A_out.js30
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test478/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test478/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test479/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test479/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test480/A_in.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test480/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test481/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test481/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test482/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test482/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test483/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test483/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test484/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test484/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test485/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test485/A_out.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test486/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test486/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test487/A_in.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test487/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test488/A_in.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test488/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test489/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test489/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test490/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test490/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test491/BundleChain_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test491/BundleChain_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test491/formatter.xml181
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test492/Main_in.js1574
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test492/Main_out.js1574
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test492/core_formatting.xml181
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test493/MyClass_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test493/MyClass_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test494/A_in.js26
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test494/A_out.js25
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test494/format.xml180
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test495/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test495/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test496/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test496/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test497/A_in.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test497/A_out.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test498/A_in.js207
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test498/A_out.js205
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test499/A_in.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test499/A_out.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test500/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test500/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test501/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test501/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test501/formatter.xml183
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test502/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test502/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test503/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test503/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test504/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test504/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test505/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test505/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test506/A_in.js77
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test506/A_out.js87
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test507/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test507/A_out.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test508/A_in.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test508/A_out.js22
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test509/A_in.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test509/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test510/A_in.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test510/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test511/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test511/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test512/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test512/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test513/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test513/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test514/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test514/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test514/formatter.xml186
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test515/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test515/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test516/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test516/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test517/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test517/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test518/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test518/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test519/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test519/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test520/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test520/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test521/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test521/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test522/A_in.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test522/A_out.js33
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test523/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test523/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test524/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test524/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test525/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test525/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test526/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test526/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test527/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test527/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test528/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test528/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test529/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test529/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test530/A_in.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test530/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test531/A_in.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test531/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test532/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test532/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test533/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test533/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test534/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test534/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test535/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test535/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test536/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test536/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test537/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test537/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test538/A_in.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test538/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test539/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test539/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test540/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test540/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test541/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test541/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test542/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test542/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test543/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test543/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test544/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test544/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test545/A_in.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test545/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test546/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test546/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test547/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test547/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test548/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test548/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test549/A_in.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test549/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test550/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test550/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test551/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test551/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test552/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test552/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test553/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test553/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test554/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test554/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test555/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test555/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test556/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test556/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test557/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test557/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test558/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test558/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test559/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test559/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test560/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test560/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test561/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test561/A_out.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test562/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test562/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test563/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test563/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test564/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test564/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test565/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test565/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test566/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test566/A_out.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test567/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test567/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test568/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test568/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test569/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test569/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test570/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test570/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test571/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test571/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test572/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test572/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test573/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test573/A_out.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test574/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test574/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test575/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test575/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test576/A_in.js41
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test576/A_out.js40
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test577/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test577/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test578/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test578/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test579/A_in.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test579/A_out.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test580/A_in.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test580/A_out.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test581/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test581/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test582/A_in.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test582/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test583/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test583/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test584/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test584/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test585/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test585/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test586/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test586/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test587/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test587/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test588/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test588/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test589/A_in.js35
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test589/A_out.js34
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test590/A_in.js33
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test590/A_out.js33
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test591/A_in.js33
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test591/A_out.js33
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test592/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test592/A_out.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test593/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test593/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test594/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test594/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test595/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test595/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test596/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test596/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test597/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test597/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test598/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test598/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test599/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test599/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test600/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test600/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test601/A_in.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test601/A_out.js36
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test605/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test605/A_out.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test606/A_in.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test606/A_out.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test607/A_in.js70
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test607/A_out.js69
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test608/A_in.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test608/A_out.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test609/A_in.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test609/A_out.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test610/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test610/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test610/formatter.xml246
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test612/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test612/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test613/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test613/A_out.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test614/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test614/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test615/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test615/A_out.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test616/A_in.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test616/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test617/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test617/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test617/formatter.xml246
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test618/A_in.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test618/A_out.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test619/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test619/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test620/A_in.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test620/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test621/A_in.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test621/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test622/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test622/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test623/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test623/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test624/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test624/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test625/A_in.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test625/A_out.js13298
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test626/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test626/A_out.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test627/A_in.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test627/A_out.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test628/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test628/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test629/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test629/A_out.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test630/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test630/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test631/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test631/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test632/A_in.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test632/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test633/A_in.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test633/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test634/A_in.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test634/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test635/A_in.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test635/A_out.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test636/A_in.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test636/A_out.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test637/A_in.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test637/A_out.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test638/A_in.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test638/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test639/A_in.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test639/A_out.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test640/A_in.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test640/A_out.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test641/A_in.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test641/A_out.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test642/A_in.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test642/A_out.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test642/formatter.prefs248
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test642/formatter.xml251
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test643/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test643/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test644/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test644/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test645/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test645/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test646/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test646/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test647/A_in.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test647/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test648/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test648/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test649/A_in.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test649/A_out.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test650/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test650/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test651/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test651/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test652/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test652/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test653/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test653/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test654/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test654/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test655/A_in.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Formatter/test655/A_out.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/.settings/.jsdtscope7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/NotInClasspath/p/Y.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/otherSrc()/X31997.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/otherSrc()/X92210.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/otherSrc()/Y31997.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/CA.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/D.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/E.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/O.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/Test.js29
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/TypeReferenceAsSingleNameReference.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/W.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/X.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a2/X.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a3/References.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a3/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a3/Y.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a3/Z.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a3/b/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a3/b/B.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a4/X.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a5/B.js25
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a6/A.js26
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a7/X.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a8/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/a9/A.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/b1/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/b1/B.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/p/A.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/p/X.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/p/Y.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/p/Z.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/p/cls1.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/p/usecls1.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/wc1/X.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/wc2/Y.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JSSearch/src/wc3/X44884.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectSrcTests/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectSrcTests/.settings/.jsdtscope6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectSrcTests/src/A.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/.settings/.jsdtscope7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/B.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/lib.jarbin783 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/lib142530.jarbin316 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/lib148949.jarbin308 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/q/A.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/q/readme.txt0
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/x/readme.txt0
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/x/readme2.txt0
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaProjectTests/x/y/Main.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/.settings/.jsdtscope15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/AbortCompilation.jarbin1711 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/AbortCompilation.zipbin2522 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/MyJar.jarbin2040 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/MyJar.zipbin533 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/NotInClasspath/p/Y.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/b111416.jarbin846 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/corrupt.jar0
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/otherSrc()/X31997.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/otherSrc()/X92210.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/otherSrc()/Y31997.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/B.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/CA.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/D.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/E.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/InterfaceImplementors.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/MemberTypeReference/Azz.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/MemberTypeReference/B.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/NoReference/A.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/O.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/ObjectMemberTypeReference/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PR_1GGNOTF.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/A.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/B.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/C.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/D.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/E.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/F.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/G.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/H.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/I.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/J.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/K.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceA.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceB.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceC.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceD.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceE.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceF.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceG.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceH.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceI.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/PackageReference/NoReferenceJ.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/Test.js22
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceAsSingleNameReference.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceInArray/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/TypeReferenceInImport/X.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/A.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/B.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/C.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/VariousTypeReferences/D.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/W.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/X.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a2/X.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a3/References.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a3/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a3/Y.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a3/Z.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a3/b/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a3/b/B.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a4/X.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a5/B.js25
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a6/A.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a7/X.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a8/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/a9/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b1/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b1/B.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b111416/X.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b2/X.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b2/Y.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b2/Z.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b3/X.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b4/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b5/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b6/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b7/X.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b8/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/b9/Foo.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c1/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c1/B.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c1/I.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c10/X.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c11/A.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c2/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c2/B.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c3/C.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c4/X.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c5/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c6/X.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c7/X.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c7/Y.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c8/X.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c8/Y.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/c9/X.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d1/X.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d2/Y.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d2/Z.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d3/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d4/X.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d4/Y.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d5/X.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d5/Y.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d6/X.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d6/Y.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d7/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d8/A.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d8/AA.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d9/p1/A.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/d9/p2/B.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e1/A29366.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e2/X.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e3/X31985.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e3/Y31985.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e4/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e5/A1.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e6/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e7/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e8/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/e9/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/f1/X.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/f2/X.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/f3/X.js24
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j1/JavadocHiddenRef.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j1/JavadocInvalidRef.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j1/JavadocSearched.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j1/JavadocValidRef.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j2/Bug47968.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j2/Bug47968s.js30
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j3/Y.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/CC47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/CF47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/CM47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/CT47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/FC47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/FF47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/FM47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/FT47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/MC47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/MF47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/MM47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/MT47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/TC47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/TF47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/TM47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j4/TT47209.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j5/Bug49994.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j6/Bug54962.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/j7/qua/li/fied/Bug54962a.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/net/sf/saxon/om/Navigator.js637
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p/A.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p/I.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p/X.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p/Y.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p/Z.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p10/a/b/dom/Y.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p10/a/b/om/X.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p2/Z.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p3/X.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p3/p2/p/X.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p4/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p5/A.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p6/A.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p7/A.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p71267/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p71267/q71267/Test.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p8/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/p9/X.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q1/B.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q2/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q3/A$B.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q4/C.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q5/AQ.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q6/CD.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q7/AQ.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q8/EclipseTest.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/q9/I.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r/A.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r2/I.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r2/X.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r3/A21485.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r4/B21485.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r5/XYZ.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r6/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r6/B.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r7/A.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r7/B.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r8/A.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/r9/A.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/s1/X.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/s1/Y.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/s2/X.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/s2/Z.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/s3/A.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/s4/X.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/s5/A.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/sd/AQ.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/wc/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/wc1/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/wc2/Y.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/src/wc3/X44884.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/test20631.jarbin978 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/test20631.zipbin208 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/test24741.jarbin1145 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/test47909.jarbin1093 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/test47989.jarbin1168 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/test48261.jarbin1207 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch/test48725.jarbin1240 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/.classpath6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/a1/Author.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/a1/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/e1/Team.js29
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/e1/Test.js28
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/m/def/Generic.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/m/def/NonGeneric.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/m/ref/R1.js26
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/m/ref/R2.js26
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/m/ref/R3.js26
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/m/ref/R4.js26
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/s/def/Generic.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/s/def/NonGeneric.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/s/ref/R1.js26
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/s/ref/R2.js26
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/s/ref/R3.js26
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g1/t/s/ref/R4.js26
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/def/R1.js38
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/def/R2.js38
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/def/R3.js54
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/def/R4.js38
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/ref/RR1.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/ref/RR2.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/ref/RR3.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/m/ref/RR4.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/def/R1.js38
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/def/R2.js38
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/def/R3.js54
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/def/R4.js38
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/ref/RR1.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/ref/RR2.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/ref/RR3.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g2/f/s/ref/RR4.js21
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/def/GM.js20
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/def/GS.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/def/NGM.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/def/NGS.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/ref/R1.js43
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/ref/R2.js43
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/ref/R3.js43
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g3/t/ref/R4.js43
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g4/v/ref/R1.js35
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g4/v/ref/R2.js36
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g4/v/ref/R3.js35
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g4/v/ref/R4.js35
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g4/v/ref/R5.js48
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/c/def/Multiple.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/c/def/Single.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/c/ref/RefMultiple.js27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/c/ref/RefRaw.js22
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/c/ref/RefSingle.js27
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/m/def/Multiple.js32
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/m/def/Single.js32
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/m/ref/RefMultiple.js42
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/m/ref/RefRaw.js26
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g5/m/ref/RefSingle.js59
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g6/t/def/List.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g6/t/def/Table.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g6/t/ref/Multiple.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g6/t/ref/QualifMultiple.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g6/t/ref/QualifSingle.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/g6/t/ref/Single.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/p1/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/p1/Y.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/p2/X.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/p2/Y.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/p3/X.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s1/A.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s1/B.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s1/C.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s1/D.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s1/pack/age/S.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s2/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s2/B.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s2/C.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s2/D.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/s2/pack/age/S.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearch15/src/v1/X.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/.classpath19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/JavaSearch15.jarbin8077 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b110422.jarbin724 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b123679.jarbin2782 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b124469.jarbin6234 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b124645.jarbin6715 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b125178.jarbin2098 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b126330.jarbin1135 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b128877.jarbin1851 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b137984.jarbin1688 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b140156.jarbin928 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b148215.jarbin1675 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b164791.jarbin3587 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b166348.jarbin955 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b86293.jarbin1568 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b87627.jarbin1169 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b89848/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b89848/X.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/b95152.jarbin6646 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/test75816.jarbin1169 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/lib/test81556.jarbin717 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b108088/B108088.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b108088/Test108088.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b123679/pack/I123679.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b123679/test/Test.js19
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b124645/T_124645.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b124645/test/A_124645.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b124645/test/X_124645.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b124645/xy/X_124645.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b124645/xy/Y_124645.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b127628/Test127628.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b137984/C.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b163984/A.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b163984/B.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b163984/C.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b81556/a/A81556.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b81556/a/B81556.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b81556/a/X81556.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b81556/b/XX81556.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b86380/Annot.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchBugs/src/b95794/Test.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchMultipleProjects1/.classpath6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchMultipleProjects1/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchMultipleProjects1/lib/p/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchMultipleProjects2/.classpath8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchMultipleProjects2/.project18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchMultipleProjects2/lib/p/Y.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/JavaSearchMultipleProjects2/src/q/Z.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/.settings/.jsdtscope16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCall.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/class-folder/ResolveConstructorCallOfMemberType2.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/class-folder/test0101/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/jj.jarbin997 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/jjsrc.zipbin428 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/p3.jarbin483 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/p3src.zipbin328 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/p4.jarbin483 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/p4src.zipbin328 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveAbstractMethod.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveArgumentName.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveArrayLength.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveArrayParameterInsideParent1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentName.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentType1.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveCatchArgumentType2.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveClass1.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveClass2.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveClass3.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveClass4.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveClass5.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveClass6.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveConstructor.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveConstructorDeclaration.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDeepLocalVariable.js24
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateFieldDeclaration.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateFieldDeclaration3.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateMethodDeclaration.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateMethodDeclaration11.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateMethodDeclaration3.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateMethodDeclaration5.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateMethodDeclaration7.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateMethodDeclaration9.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateTypeDeclaration.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateTypeDeclaration3.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveDuplicateTypeDeclaration5.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveEmptySelectionOnMethod.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveEndOfFile.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveExplicitSuperConstructorCall.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveExplicitThisConstructorCall.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveField.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveField0.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveFieldDeclaration.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveImport.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveInnerClassAsParamater.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveInterface.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalClass1.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalClass2.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalClass3.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalClass4.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalClass5.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalClass6.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalClass7.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalConstructor.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalConstructorDeclaration.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalField.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalField2.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalFieldDeclaration.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalMemberTypeDeclaration1.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalMemberTypeDeclaration2.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalMethod.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalMethod2.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalMethodDeclaration.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalName.js15
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveLocalVariable.js18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMemberTypeDeclaration1.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMemberTypeDeclaration2.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMessageSendOnBaseType.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMethod.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMethodDeclaration.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMethodDeclarationInAnonymous.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMethodDeclarationInAnonymous2.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMethodDeclarationInAnonymous3.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMethodDeclarationInInterface.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveMethodWithIncorrectParameter.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolvePackage.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolvePartiallyQualifiedType.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedName1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedName2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedName3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedName4.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedName5.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveQualifiedType.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveTypeDeclaration.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveTypeEmptySelection.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveTypeEmptySelection2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveTypeInComment.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/ResolveUnicode.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/SuperClass.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/SuperInterface.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/X1.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/a/b/ImportedClass.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/b120350/Test.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/b120350/X.js1
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/p1/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/p1/Y.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/p2/X.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src/pp/qq/XX.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0001/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0002/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0003/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0005/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0006/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0007/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0008/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0009/Test.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0010/Test.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0011/Test.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0012/Test.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0013/Test.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0014/Test.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0015/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0016/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0017/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0018/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0019/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0020/Test.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0021/Test.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0022/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0022/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0022/X.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0022/Y.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0023/Test.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0024/Test.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/src2/test0025/Test.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/test0023.jarbin4537 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/test0023src.zipbin923 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/test25888.jarbin1083 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/test25888src.zipbin286 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/test47177.jarbin1236 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/test47177src.zipbin608 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/test47214.jarbin1126 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/zzz.jarbin1621 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/Resolve/zzzsrc.zipbin400 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/SnippetCompletion/.classpath16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/SnippetCompletion/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/SnippetCompletion/class-folder/aa/bb/cc/CClass.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/SnippetCompletion/class-folder/bug132665/Bug132665.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/SnippetCompletion/src/aa/bb/cc/BClass.js16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/.settings/.jsdtscope16
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/NotInClasspath/e/E.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/lib.jarbin6026 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/lib48459/p48459/p2/Y48459.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/lib53095/p53095/X53095.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/cycle/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/cycle/Y.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p1/A.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p1/Deep.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p1/I1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p1/I2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p1/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p1/Y.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p1/Z.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p2/I.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p2/I1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p2/I2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p2/I3.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p2/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p2/Y.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p3/A.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p3/B.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p3/I.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p3/I1.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p4/X.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p48459/p1/X48459.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p48459/p1/Z48459.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p5/X.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p6/A.js12
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p7/A.js37
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p7/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p8/X.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/p9/X.js9
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q1/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q1/Z.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q2/Y.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q3/Z.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q4/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q4/Y.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q5/X.js7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q6/Y.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q6/Z.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/q7/X.js11
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/src/wc/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/test144976.jarbin1235 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/test49809.jarbin682 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/test54043.jarbin2263 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/test58440.jarbin1620 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchy/test60365.jarbin902 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyDependent/.project18
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyDependent/.settings/.jsdtscope7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyDependent/Dependent.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/.settings/.jsdtscope7
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/a/A.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/b/B.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/c/C.js5
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/d/D.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/e/E.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/i/I1.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/i/I2.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/External.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/MyError.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/X.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p/other/External.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p2/A.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p2/B.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p3/A.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchyNotification/src/p3/B.js4
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchySerialization/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchySerialization/.settings/.jsdtscope6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/Y.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeHierarchySerialization/src/p1/Z.js2
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/.project17
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/.settings/.jsdtscope6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/src/p/TypeResolve.js13
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/src/p1/X.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/src/p2/Y.js3
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/src/p3/B.js14
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/src/p4/A.js8
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/src/p4/B.js6
-rw-r--r--tests/org.eclipse.wst.jsdt.core.tests.model/workspace/TypeResolve/src/p5/A.js10
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.core.tests/.classpath7
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.core.tests/.project28
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.core.tests/.settings/org.eclipse.jdt.core.prefs90
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.core.tests/META-INF/MANIFEST.MF12
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.core.tests/OSGI-INF/l10n/bundle.properties12
-rwxr-xr-xtests/org.eclipse.wst.jsdt.debug.core.tests/about.html28
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.core.tests/build.properties7
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.core.tests/src/org/eclipse/wst/debug/core/tests/JSDTDebugTestPlugin.java50
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/.classpath7
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/.project28
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/.settings/org.eclipse.jdt.core.prefs90
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/META-INF/MANIFEST.MF13
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/OSGI-INF/l10n/bundle.properties12
-rwxr-xr-xtests/org.eclipse.wst.jsdt.debug.rhino.tests/about.html28
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/build.properties9
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/scripts/script1.js17
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/BreakpointRequestTests.java176
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/ConnectionHelper.java58
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/DebugSessionTest.java245
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/FrameRequestTests.java99
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RequestBadCommandTest.java26
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RequestContinueTest.java26
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RequestDisposeTest.java26
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RequestLookupTest.java90
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RequestSuspendTest.java26
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RequestTest.java446
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RequestVersionTest.java30
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RhinoDebugTestSuite.java45
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/RhinoDebuggerTest.java65
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/ScriptRequestTests.java95
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/TestEventHandler.java279
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/ThreadRequestTests.java66
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/TransportTest.java114
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/src/org/eclipse/wst/jsdt/debug/rhino/tests/Util.java216
-rw-r--r--tests/org.eclipse.wst.jsdt.debug.rhino.tests/test.xml119
-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/.classpath7
-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/.cvsignore2
-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/.project28
-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/.settings/org.eclipse.jdt.core.prefs12
-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/META-INF/MANIFEST.MF22
-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/about.html28
-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/build.properties20
-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/icons/full/eview16/package.gifbin145 -> 0 bytes-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/plugin.properties17
-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/plugin.xml14
-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/src/org/eclipse/wst/jsdt/ui/tests/EditorTests.java80
-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/src/org/eclipse/wst/jsdt/ui/tests/JSDTUITests.java58
-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/src/org/eclipse/wst/jsdt/ui/tests/internal/Activator.java29
-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/src/org/eclipse/wst/jsdt/ui/tests/internal/JsStorageEditorInput.java164
-rw-r--r--tests/org.eclipse.wst.jsdt.ui.tests/test.xml117
4000 files changed, 0 insertions, 360520 deletions
diff --git a/features/org.eclipse.wst.jsdt_tests.feature/.cvsignore b/features/org.eclipse.wst.jsdt_tests.feature/.cvsignore
deleted file mode 100644
index c14487c..0000000
--- a/features/org.eclipse.wst.jsdt_tests.feature/.cvsignore
+++ /dev/null
@@ -1 +0,0 @@
-build.xml
diff --git a/features/org.eclipse.wst.jsdt_tests.feature/.project b/features/org.eclipse.wst.jsdt_tests.feature/.project
deleted file mode 100644
index 808c20f..0000000
--- a/features/org.eclipse.wst.jsdt_tests.feature/.project
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.wst.jsdt_tests.feature</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.pde.FeatureBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.FeatureNature</nature>
- </natures>
-</projectDescription>
diff --git a/features/org.eclipse.wst.jsdt_tests.feature/.settings/org.eclipse.core.resources.prefs b/features/org.eclipse.wst.jsdt_tests.feature/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 06da1cb..0000000
--- a/features/org.eclipse.wst.jsdt_tests.feature/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,3 +0,0 @@
-#Wed Dec 12 03:20:23 EST 2007
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
diff --git a/features/org.eclipse.wst.jsdt_tests.feature/build.properties b/features/org.eclipse.wst.jsdt_tests.feature/build.properties
deleted file mode 100644
index 27affc5..0000000
--- a/features/org.eclipse.wst.jsdt_tests.feature/build.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-bin.includes = feature.xml,\
- epl-v10.html,\
- eclipse_update_120.jpg,\
- license.html,\
- feature.properties
diff --git a/features/org.eclipse.wst.jsdt_tests.feature/eclipse_update_120.jpg b/features/org.eclipse.wst.jsdt_tests.feature/eclipse_update_120.jpg
deleted file mode 100644
index bfdf708..0000000
--- a/features/org.eclipse.wst.jsdt_tests.feature/eclipse_update_120.jpg
+++ /dev/null
Binary files differ
diff --git a/features/org.eclipse.wst.jsdt_tests.feature/epl-v10.html b/features/org.eclipse.wst.jsdt_tests.feature/epl-v10.html
deleted file mode 100644
index ed4b196..0000000
--- a/features/org.eclipse.wst.jsdt_tests.feature/epl-v10.html
+++ /dev/null
@@ -1,328 +0,0 @@
-<html xmlns:o="urn:schemas-microsoft-com:office:office"
-xmlns:w="urn:schemas-microsoft-com:office:word"
-xmlns="http://www.w3.org/TR/REC-html40">
-
-<head>
-<meta http-equiv=Content-Type content="text/html; charset=windows-1252">
-<meta name=ProgId content=Word.Document>
-<meta name=Generator content="Microsoft Word 9">
-<meta name=Originator content="Microsoft Word 9">
-<link rel=File-List
-href="./Eclipse%20EPL%202003_11_10%20Final_files/filelist.xml">
-<title>Eclipse Public License - Version 1.0</title>
-<!--[if gte mso 9]><xml>
- <o:DocumentProperties>
- <o:Revision>2</o:Revision>
- <o:TotalTime>3</o:TotalTime>
- <o:Created>2004-03-05T23:03:00Z</o:Created>
- <o:LastSaved>2004-03-05T23:03:00Z</o:LastSaved>
- <o:Pages>4</o:Pages>
- <o:Words>1626</o:Words>
- <o:Characters>9270</o:Characters>
- <o:Lines>77</o:Lines>
- <o:Paragraphs>18</o:Paragraphs>
- <o:CharactersWithSpaces>11384</o:CharactersWithSpaces>
- <o:Version>9.4402</o:Version>
- </o:DocumentProperties>
-</xml><![endif]--><!--[if gte mso 9]><xml>
- <w:WordDocument>
- <w:TrackRevisions/>
- </w:WordDocument>
-</xml><![endif]-->
-<style>
-<!--
- /* Font Definitions */
-@font-face
- {font-family:Tahoma;
- panose-1:2 11 6 4 3 5 4 4 2 4;
- mso-font-charset:0;
- mso-generic-font-family:swiss;
- mso-font-pitch:variable;
- mso-font-signature:553679495 -2147483648 8 0 66047 0;}
- /* Style Definitions */
-p.MsoNormal, li.MsoNormal, div.MsoNormal
- {mso-style-parent:"";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p
- {margin-right:0in;
- mso-margin-top-alt:auto;
- mso-margin-bottom-alt:auto;
- margin-left:0in;
- mso-pagination:widow-orphan;
- font-size:12.0pt;
- font-family:"Times New Roman";
- mso-fareast-font-family:"Times New Roman";}
-p.BalloonText, li.BalloonText, div.BalloonText
- {mso-style-name:"Balloon Text";
- margin:0in;
- margin-bottom:.0001pt;
- mso-pagination:widow-orphan;
- font-size:8.0pt;
- font-family:Tahoma;
- mso-fareast-font-family:"Times New Roman";}
-@page Section1
- {size:8.5in 11.0in;
- margin:1.0in 1.25in 1.0in 1.25in;
- mso-header-margin:.5in;
- mso-footer-margin:.5in;
- mso-paper-source:0;}
-div.Section1
- {page:Section1;}
--->
-</style>
-</head>
-
-<body lang=EN-US style='tab-interval:.5in'>
-
-<div class=Section1>
-
-<p align=center style='text-align:center'><b>Eclipse Public License - v 1.0</b>
-</p>
-
-<p><span style='font-size:10.0pt'>THE ACCOMPANYING PROGRAM IS PROVIDED UNDER
-THE TERMS OF THIS ECLIPSE PUBLIC LICENSE (&quot;AGREEMENT&quot;). ANY USE,
-REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>1. DEFINITIONS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Contribution&quot; means:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-in the case of the initial Contributor, the initial code and documentation
-distributed under this Agreement, and<br clear=left>
-b) in the case of each subsequent Contributor:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-changes to the Program, and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-additions to the Program;</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>where
-such changes and/or additions to the Program originate from and are distributed
-by that particular Contributor. A Contribution 'originates' from a Contributor
-if it was added to the Program by such Contributor itself or anyone acting on
-such Contributor's behalf. Contributions do not include additions to the
-Program which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii) are not derivative
-works of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Contributor&quot; means any person or
-entity that distributes the Program.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Licensed Patents &quot; mean patent
-claims licensable by a Contributor which are necessarily infringed by the use
-or sale of its Contribution alone or when combined with the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>&quot;Program&quot; means the Contributions
-distributed in accordance with this Agreement.</span> </p>
-
-<p><span style='font-size:10.0pt'>&quot;Recipient&quot; means anyone who
-receives the Program under this Agreement, including all Contributors.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>2. GRANT OF RIGHTS</span></b> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-Subject to the terms of this Agreement, each Contributor hereby grants Recipient
-a non-exclusive, worldwide, royalty-free copyright license to<span
-style='color:red'> </span>reproduce, prepare derivative works of, publicly
-display, publicly perform, distribute and sublicense the Contribution of such
-Contributor, if any, and such derivative works, in source code and object code
-form.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide,<span style='color:green'> </span>royalty-free
-patent license under Licensed Patents to make, use, sell, offer to sell, import
-and otherwise transfer the Contribution of such Contributor, if any, in source
-code and object code form. This patent license shall apply to the combination
-of the Contribution and the Program if, at the time the Contribution is added
-by the Contributor, such addition of the Contribution causes such combination
-to be covered by the Licensed Patents. The patent license shall not apply to
-any other combinations which include the Contribution. No hardware per se is
-licensed hereunder. </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>c)
-Recipient understands that although each Contributor grants the licenses to its
-Contributions set forth herein, no assurances are provided by any Contributor
-that the Program does not infringe the patent or other intellectual property
-rights of any other entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement of intellectual
-property rights or otherwise. As a condition to exercising the rights and
-licenses granted hereunder, each Recipient hereby assumes sole responsibility
-to secure any other intellectual property rights needed, if any. For example,
-if a third party patent license is required to allow Recipient to distribute
-the Program, it is Recipient's responsibility to acquire that license before
-distributing the Program.</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>d)
-Each Contributor represents that to its knowledge it has sufficient copyright
-rights in its Contribution, if any, to grant the copyright license set forth in
-this Agreement. </span></p>
-
-<p><b><span style='font-size:10.0pt'>3. REQUIREMENTS</span></b> </p>
-
-<p><span style='font-size:10.0pt'>A Contributor may choose to distribute the
-Program in object code form under its own license agreement, provided that:</span>
-</p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it complies with the terms and conditions of this Agreement; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b)
-its license agreement:</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>i)
-effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title
-and non-infringement, and implied warranties or conditions of merchantability
-and fitness for a particular purpose; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>ii)
-effectively excludes on behalf of all Contributors all liability for damages,
-including direct, indirect, special, incidental and consequential damages, such
-as lost profits; </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iii)
-states that any provisions which differ from this Agreement are offered by that
-Contributor alone and not by any other party; and</span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>iv)
-states that source code for the Program is available from such Contributor, and
-informs licensees how to obtain it in a reasonable manner on or through a
-medium customarily used for software exchange.<span style='color:blue'> </span></span></p>
-
-<p><span style='font-size:10.0pt'>When the Program is made available in source
-code form:</span> </p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>a)
-it must be made available under this Agreement; and </span></p>
-
-<p class=MsoNormal style='margin-left:.5in'><span style='font-size:10.0pt'>b) a
-copy of this Agreement must be included with each copy of the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Contributors may not remove or alter any
-copyright notices contained within the Program. </span></p>
-
-<p><span style='font-size:10.0pt'>Each Contributor must identify itself as the
-originator of its Contribution, if any, in a manner that reasonably allows
-subsequent Recipients to identify the originator of the Contribution. </span></p>
-
-<p><b><span style='font-size:10.0pt'>4. COMMERCIAL DISTRIBUTION</span></b> </p>
-
-<p><span style='font-size:10.0pt'>Commercial distributors of software may
-accept certain responsibilities with respect to end users, business partners
-and the like. While this license is intended to facilitate the commercial use
-of the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create potential
-liability for other Contributors. Therefore, if a Contributor includes the
-Program in a commercial product offering, such Contributor (&quot;Commercial
-Contributor&quot;) hereby agrees to defend and indemnify every other
-Contributor (&quot;Indemnified Contributor&quot;) against any losses, damages and
-costs (collectively &quot;Losses&quot;) arising from claims, lawsuits and other
-legal actions brought by a third party against the Indemnified Contributor to
-the extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor
-to control, and cooperate with the Commercial Contributor in, the defense and
-any related settlement negotiations. The Indemnified Contributor may participate
-in any such claim at its own expense.</span> </p>
-
-<p><span style='font-size:10.0pt'>For example, a Contributor might include the
-Program in a commercial product offering, Product X. That Contributor is then a
-Commercial Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance claims and
-warranties are such Commercial Contributor's responsibility alone. Under this
-section, the Commercial Contributor would have to defend claims against the
-other Contributors related to those performance claims and warranties, and if a
-court requires any other Contributor to pay any damages as a result, the
-Commercial Contributor must pay those damages.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>5. NO WARRANTY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, THE PROGRAM IS PROVIDED ON AN &quot;AS IS&quot; BASIS, WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING,
-WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and distributing the
-Program and assumes all risks associated with its exercise of rights under this
-Agreement , including but not limited to the risks and costs of program errors,
-compliance with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations. </span></p>
-
-<p><b><span style='font-size:10.0pt'>6. DISCLAIMER OF LIABILITY</span></b> </p>
-
-<p><span style='font-size:10.0pt'>EXCEPT AS EXPRESSLY SET FORTH IN THIS
-AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY
-OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF
-THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGES.</span> </p>
-
-<p><b><span style='font-size:10.0pt'>7. GENERAL</span></b> </p>
-
-<p><span style='font-size:10.0pt'>If any provision of this Agreement is invalid
-or unenforceable under applicable law, it shall not affect the validity or
-enforceability of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be reformed to the
-minimum extent necessary to make such provision valid and enforceable.</span> </p>
-
-<p><span style='font-size:10.0pt'>If Recipient institutes patent litigation
-against any entity (including a cross-claim or counterclaim in a lawsuit)
-alleging that the Program itself (excluding combinations of the Program with
-other software or hardware) infringes such Recipient's patent(s), then such
-Recipient's rights granted under Section 2(b) shall terminate as of the date
-such litigation is filed. </span></p>
-
-<p><span style='font-size:10.0pt'>All Recipient's rights under this Agreement
-shall terminate if it fails to comply with any of the material terms or
-conditions of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If all Recipient's
-rights under this Agreement terminate, Recipient agrees to cease use and
-distribution of the Program as soon as reasonably practicable. However,
-Recipient's obligations under this Agreement and any licenses granted by
-Recipient relating to the Program shall continue and survive. </span></p>
-
-<p><span style='font-size:10.0pt'>Everyone is permitted to copy and distribute
-copies of this Agreement, but in order to avoid inconsistency the Agreement is
-copyrighted and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including revisions) of
-this Agreement from time to time. No one other than the Agreement Steward has
-the right to modify this Agreement. The Eclipse Foundation is the initial
-Agreement Steward. The Eclipse Foundation may assign the responsibility to
-serve as the Agreement Steward to a suitable separate entity. Each new version
-of the Agreement will be given a distinguishing version number. The Program
-(including Contributions) may always be distributed subject to the version of
-the Agreement under which it was received. In addition, after a new version of
-the Agreement is published, Contributor may elect to distribute the Program
-(including its Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to
-the intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.</span> </p>
-
-<p><span style='font-size:10.0pt'>This Agreement is governed by the laws of the
-State of New York and the intellectual property laws of the United States of
-America. No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose. Each party waives
-its rights to a jury trial in any resulting litigation.</span> </p>
-
-<p class=MsoNormal><![if !supportEmptyParas]>&nbsp;<![endif]><o:p></o:p></p>
-
-</div>
-
-</body>
-
-</html> \ No newline at end of file
diff --git a/features/org.eclipse.wst.jsdt_tests.feature/feature.properties b/features/org.eclipse.wst.jsdt_tests.feature/feature.properties
deleted file mode 100644
index c4d1bc9..0000000
--- a/features/org.eclipse.wst.jsdt_tests.feature/feature.properties
+++ /dev/null
@@ -1,170 +0,0 @@
-###############################################################################
-# Copyright (c) 2007, 2010 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-# feature.properties
-# contains externalized strings for feature.xml
-# "%foo" in feature.xml corresponds to the key "foo" in this file
-# java.io.Properties file (ISO 8859-1 with "\" escapes)
-# This file should be translated.
-
-# "featureName" property - name of the feature
-featureName=JSDT Tests
-
-# "providerName" property - name of the company that provides the feature
-providerName=Eclipse Web Tools Platform
-
-# "updateSiteName" property - label for the update site
-updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site
-
-# "description" property - description of the feature
-description=JSDT Tests
-
-# "copyright" property - text of the "Feature Update Copyright"
-copyright=\
-Copyright (c) 2000, 2010 IBM Corporation and others.\n\
-All rights reserved. This program and the accompanying materials\n\
-are made available under the terms of the Eclipse Public License v1.0\n\
-which accompanies this distribution, and is available at\n\
-http://www.eclipse.org/legal/epl-v10.html\n\
-\n\
-Contributors:\n\
- IBM Corporation - initial API and implementation\n
-################ end of copyright property ####################################
-
-# "licenseURL" property - URL of the "Feature License"
-# do not translate value - just change to point to a locale-specific HTML page
-licenseURL=license.html
-
-# "license" property - text of the "Feature Update License"
-# should be plain text version of license agreement pointed to be "licenseURL"
-license=\
-Eclipse Foundation Software User Agreement\n\
-April 14, 2010\n\
-\n\
-Usage Of Content\n\
-\n\
-THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\
-OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\
-USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\
-AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\
-NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\
-AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\
-AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\
-OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\
-TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\
-OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\
-BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\
-\n\
-Applicable Licenses\n\
-\n\
-Unless otherwise indicated, all Content made available by the\n\
-Eclipse Foundation is provided to you under the terms and conditions of\n\
-the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\
-provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\
-For purposes of the EPL, "Program" will mean the Content.\n\
-\n\
-Content includes, but is not limited to, source code, object code,\n\
-documentation and other files maintained in the Eclipse Foundation source code\n\
-repository ("Repository") in software modules ("Modules") and made available\n\
-as downloadable archives ("Downloads").\n\
-\n\
- - Content may be structured and packaged into modules to facilitate delivering,\n\
- extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\
- plug-in fragments ("Fragments"), and features ("Features").\n\
- - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\
- in a directory named "plugins".\n\
- - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\
- Each Feature may be packaged as a sub-directory in a directory named "features".\n\
- Within a Feature, files named "feature.xml" may contain a list of the names and version\n\
- numbers of the Plug-ins and/or Fragments associated with that Feature.\n\
- - Features may also include other Features ("Included Features"). Within a Feature, files\n\
- named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\
-\n\
-The terms and conditions governing Plug-ins and Fragments should be\n\
-contained in files named "about.html" ("Abouts"). The terms and\n\
-conditions governing Features and Included Features should be contained\n\
-in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\
-Licenses may be located in any directory of a Download or Module\n\
-including, but not limited to the following locations:\n\
-\n\
- - The top-level (root) directory\n\
- - Plug-in and Fragment directories\n\
- - Inside Plug-ins and Fragments packaged as JARs\n\
- - Sub-directories of the directory named "src" of certain Plug-ins\n\
- - Feature directories\n\
-\n\
-Note: if a Feature made available by the Eclipse Foundation is installed using the\n\
-Provisioning Technology (as defined below), you must agree to a license ("Feature \n\
-Update License") during the installation process. If the Feature contains\n\
-Included Features, the Feature Update License should either provide you\n\
-with the terms and conditions governing the Included Features or inform\n\
-you where you can locate them. Feature Update Licenses may be found in\n\
-the "license" property of files named "feature.properties" found within a Feature.\n\
-Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\
-terms and conditions (or references to such terms and conditions) that\n\
-govern your use of the associated Content in that directory.\n\
-\n\
-THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\
-TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\
-SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\
-\n\
- - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\
- - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\
- - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\
- - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\
- - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\
-\n\
-IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\
-TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\
-is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\
-govern that particular Content.\n\
-\n\
-\n\Use of Provisioning Technology\n\
-\n\
-The Eclipse Foundation makes available provisioning software, examples of which include,\n\
-but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\
-the purpose of allowing users to install software, documentation, information and/or\n\
-other materials (collectively "Installable Software"). This capability is provided with\n\
-the intent of allowing such users to install, extend and update Eclipse-based products.\n\
-Information about packaging Installable Software is available at\n\
-http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\
-\n\
-You may use Provisioning Technology to allow other parties to install Installable Software.\n\
-You shall be responsible for enabling the applicable license agreements relating to the\n\
-Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\
-in accordance with the Specification. By using Provisioning Technology in such a manner and\n\
-making it available in accordance with the Specification, you further acknowledge your\n\
-agreement to, and the acquisition of all necessary rights to permit the following:\n\
-\n\
- 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\
- the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\
- extending or updating the functionality of an Eclipse-based product.\n\
- 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\
- Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\
- 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\
- govern the use of the Installable Software ("Installable Software Agreement") and such\n\
- Installable Software Agreement shall be accessed from the Target Machine in accordance\n\
- with the Specification. Such Installable Software Agreement must inform the user of the\n\
- terms and conditions that govern the Installable Software and must solicit acceptance by\n\
- the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\
- indication of agreement by the user, the provisioning Technology will complete installation\n\
- of the Installable Software.\n\
-\n\
-Cryptography\n\
-\n\
-Content may contain encryption software. The country in which you are\n\
-currently may have restrictions on the import, possession, and use,\n\
-and/or re-export to another country, of encryption software. BEFORE\n\
-using any encryption software, please check the country's laws,\n\
-regulations and policies concerning the import, possession, or use, and\n\
-re-export of encryption software, to see if this is permitted.\n\
-\n\
-Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n
-########### end of license property ##########################################
diff --git a/features/org.eclipse.wst.jsdt_tests.feature/feature.xml b/features/org.eclipse.wst.jsdt_tests.feature/feature.xml
deleted file mode 100644
index 2054370..0000000
--- a/features/org.eclipse.wst.jsdt_tests.feature/feature.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<feature
- id="org.eclipse.wst.jsdt_tests.feature"
- label="%featureName"
- version="1.2.0.qualifier"
- provider-name="%providerName">
-
- <description>
- %description
- </description>
-
- <copyright>
- %copyright
- </copyright>
-
- <license url="license.html">
- %license
- </license>
-
- <url>
- <update label="%updateSiteName" url="http://download.eclipse.org/webtools/updates/"/>
- </url>
-
- <plugin
- id="org.eclipse.wst.jsdt.core.tests.compiler"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.wst.jsdt.core.tests.model"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.wst.jsdt.ui.tests"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.wtp.releng.versionchecker"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
- id="org.eclipse.wtp.releng.tests"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
-
- <plugin
- id="org.eclipse.wst.jsdt.debug.rhino.tests"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="true"/>
-
- <plugin
- id="org.eclipse.wst.jsdt.debug.core.tests"
- download-size="0"
- install-size="0"
- version="0.0.0"
- unpack="true"/>
-
-</feature>
diff --git a/features/org.eclipse.wst.jsdt_tests.feature/license.html b/features/org.eclipse.wst.jsdt_tests.feature/license.html
deleted file mode 100644
index c184ca3..0000000
--- a/features/org.eclipse.wst.jsdt_tests.feature/license.html
+++ /dev/null
@@ -1,107 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
-<title>Eclipse Foundation Software User Agreement</title>
-</head>
-
-<body lang="EN-US">
-<h2>Eclipse Foundation Software User Agreement</h2>
-<p>April 14, 2010</p>
-
-<h3>Usage Of Content</h3>
-
-<p>THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS
- (COLLECTIVELY &quot;CONTENT&quot;). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND
- CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE
- OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR
- NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND
- CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.</p>
-
-<h3>Applicable Licenses</h3>
-
-<p>Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0
- (&quot;EPL&quot;). A copy of the EPL is provided with this Content and is also available at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
- For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code
- repository (&quot;Repository&quot;) in software modules (&quot;Modules&quot;) and made available as downloadable archives (&quot;Downloads&quot;).</p>
-
-<ul>
- <li>Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins (&quot;Plug-ins&quot;), plug-in fragments (&quot;Fragments&quot;), and features (&quot;Features&quot;).</li>
- <li>Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java&trade; ARchive) in a directory named &quot;plugins&quot;.</li>
- <li>A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named &quot;features&quot;. Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of the Plug-ins
- and/or Fragments associated with that Feature.</li>
- <li>Features may also include other Features (&quot;Included Features&quot;). Within a Feature, files named &quot;feature.xml&quot; may contain a list of the names and version numbers of Included Features.</li>
-</ul>
-
-<p>The terms and conditions governing Plug-ins and Fragments should be contained in files named &quot;about.html&quot; (&quot;Abouts&quot;). The terms and conditions governing Features and
-Included Features should be contained in files named &quot;license.html&quot; (&quot;Feature Licenses&quot;). Abouts and Feature Licenses may be located in any directory of a Download or Module
-including, but not limited to the following locations:</p>
-
-<ul>
- <li>The top-level (root) directory</li>
- <li>Plug-in and Fragment directories</li>
- <li>Inside Plug-ins and Fragments packaged as JARs</li>
- <li>Sub-directories of the directory named &quot;src&quot; of certain Plug-ins</li>
- <li>Feature directories</li>
-</ul>
-
-<p>Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license (&quot;Feature Update License&quot;) during the
-installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or
-inform you where you can locate them. Feature Update Licenses may be found in the &quot;license&quot; property of files named &quot;feature.properties&quot; found within a Feature.
-Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in
-that directory.</p>
-
-<p>THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE
-OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):</p>
-
-<ul>
- <li>Common Public License Version 1.0 (available at <a href="http://www.eclipse.org/legal/cpl-v10.html">http://www.eclipse.org/legal/cpl-v10.html</a>)</li>
- <li>Apache Software License 1.1 (available at <a href="http://www.apache.org/licenses/LICENSE">http://www.apache.org/licenses/LICENSE</a>)</li>
- <li>Apache Software License 2.0 (available at <a href="http://www.apache.org/licenses/LICENSE-2.0">http://www.apache.org/licenses/LICENSE-2.0</a>)</li>
- <li>Metro Link Public License 1.00 (available at <a href="http://www.opengroup.org/openmotif/supporters/metrolink/license.html">http://www.opengroup.org/openmotif/supporters/metrolink/license.html</a>)</li>
- <li>Mozilla Public License Version 1.1 (available at <a href="http://www.mozilla.org/MPL/MPL-1.1.html">http://www.mozilla.org/MPL/MPL-1.1.html</a>)</li>
-</ul>
-
-<p>IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please
-contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.</p>
-
-
-<h3>Use of Provisioning Technology</h3>
-
-<p>The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse
- Update Manager (&quot;Provisioning Technology&quot;) for the purpose of allowing users to install software, documentation, information and/or
- other materials (collectively &quot;Installable Software&quot;). This capability is provided with the intent of allowing such users to
- install, extend and update Eclipse-based products. Information about packaging Installable Software is available at <a
- href="http://eclipse.org/equinox/p2/repository_packaging.html">http://eclipse.org/equinox/p2/repository_packaging.html</a>
- (&quot;Specification&quot;).</p>
-
-<p>You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the
- applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology
- in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the
- Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:</p>
-
-<ol>
- <li>A series of actions may occur (&quot;Provisioning Process&quot;) in which a user may execute the Provisioning Technology
- on a machine (&quot;Target Machine&quot;) with the intent of installing, extending or updating the functionality of an Eclipse-based
- product.</li>
- <li>During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be
- accessed and copied to the Target Machine.</li>
- <li>Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable
- Software (&quot;Installable Software Agreement&quot;) and such Installable Software Agreement shall be accessed from the Target
- Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern
- the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such
- indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.</li>
-</ol>
-
-<h3>Cryptography</h3>
-
-<p>Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to
- another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import,
- possession, or use, and re-export of encryption software, to see if this is permitted.</p>
-
-<p><small>Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.</small></p>
-</body>
-</html>
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/.classpath b/tests/org.eclipse.wst.jsdt.core.tests.model/.classpath
deleted file mode 100644
index ce73933..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/.cvsignore b/tests/org.eclipse.wst.jsdt.core.tests.model/.cvsignore
deleted file mode 100644
index 7722bc8..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-build.xml
-javaCompiler...args
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/.project b/tests/org.eclipse.wst.jsdt.core.tests.model/.project
deleted file mode 100644
index 15cf2d2..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.wst.jsdt.core.tests.model</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.core.resources.prefs b/tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.core.resources.prefs
deleted file mode 100644
index 039fac0..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.core.resources.prefs
+++ /dev/null
@@ -1,4 +0,0 @@
-#Mon Jan 28 15:47:49 CST 2008
-eclipse.preferences.version=1
-encoding/<project>=ISO-8859-1
-instance/org.eclipse.core.net/org.eclipse.core.net.hasMigrated=true
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.jdt.core.prefs b/tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index d8c99ee..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-#Tue Apr 17 15:48:57 CDT 2007
-eclipse.preferences.version=1
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
-org.eclipse.jdt.core.compiler.compliance=1.4
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
-org.eclipse.jdt.core.compiler.source=1.3
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/META-INF/MANIFEST.MF b/tests/org.eclipse.wst.jsdt.core.tests.model/META-INF/MANIFEST.MF
deleted file mode 100644
index 1dee450..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,25 +0,0 @@
-Manifest-Version: 1.0
-Bundle-ManifestVersion: 2
-Bundle-Name: %pluginName
-Bundle-SymbolicName: org.eclipse.wst.jsdt.core.tests.model; singleton:=true
-Bundle-Version: 1.0.300.qualifier
-Bundle-Vendor: %providerName
-Bundle-Localization: plugin
-Export-Package: org.eclipse.wst.jsdt.core.tests,
- org.eclipse.wst.jsdt.core.tests.dom,
- org.eclipse.wst.jsdt.core.tests.formatter,
- org.eclipse.wst.jsdt.core.tests.formatter.comment,
- org.eclipse.wst.jsdt.core.tests.model,
- org.eclipse.wst.jsdt.core.tests.rewrite.describing,
- org.eclipse.wst.jsdt.core.tests.rewrite.modifying
-Import-Package: com.ibm.icu.text; version="3.8",
- com.ibm.icu.util; version="3.8"
-Require-Bundle: org.eclipse.core.resources,
- org.eclipse.core.runtime,
- org.junit;bundle-version=3.8.2,
- org.eclipse.wst.jsdt.core.tests.compiler,
- org.eclipse.team.core,
- org.eclipse.text,
- org.eclipse.wst.jsdt.core
-Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.4
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/META-INF/eclipse.inf b/tests/org.eclipse.wst.jsdt.core.tests.model/META-INF/eclipse.inf
deleted file mode 100644
index fdcf47e..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/META-INF/eclipse.inf
+++ /dev/null
@@ -1,6 +0,0 @@
-# We do not want any nested jars
-# signed or normalized for packing
-# see bug 274743 Some unit tests are sensitive to details of build
-# https://bugs.eclipse.org/bugs/show_bug.cgi?id=274743
-
-jarprocessor.exclude.children=true \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/about.html b/tests/org.eclipse.wst.jsdt.core.tests.model/about.html
deleted file mode 100644
index 4602330..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/about.html
+++ /dev/null
@@ -1,28 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>June 2, 2006</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
-</html> \ No newline at end of file
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/build.properties b/tests/org.eclipse.wst.jsdt.core.tests.model/build.properties
deleted file mode 100644
index fe0e4e9..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/build.properties
+++ /dev/null
@@ -1,18 +0,0 @@
-###############################################################################
-# Copyright (c) 2005, 2007 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-bin.includes = plugin.xml,\
- workspace/,\
- .,\
- test.xml,\
- plugin.properties,\
- META-INF/,\
- about.html
-source.. = src/
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/plugin.properties b/tests/org.eclipse.wst.jsdt.core.tests.model/plugin.properties
deleted file mode 100644
index 48b40c9..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/plugin.properties
+++ /dev/null
@@ -1,19 +0,0 @@
-###############################################################################
-# Copyright (c) 2007, 2010 IBM Corporation and others.
-# All rights reserved. This program and the accompanying materials
-# are made available under the terms of the Eclipse Public License v1.0
-# which accompanies this distribution, and is available at
-# http://www.eclipse.org/legal/epl-v10.html
-#
-# Contributors:
-# IBM Corporation - initial API and implementation
-###############################################################################
-
-#
-# Messages in plugin.xml.
-#
-pluginName=JSDT Core Model Tests
-providerName=Eclipse Web Tools Platform
-
-JsGlobalScopeVariableInitializer.deprecated.0 = Test deprecated flag
-JsGlobalScopeVariableInitializer.deprecated.1 = A deprecated and read-only initializer
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/plugin.xml b/tests/org.eclipse.wst.jsdt.core.tests.model/plugin.xml
deleted file mode 100644
index 18bd40e..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/plugin.xml
+++ /dev/null
@@ -1,67 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.0"?>
-<plugin>
- <!-- Classpath variable initializer -->
- <extension point = "org.eclipse.wst.jsdt.core.JsGlobalScopeVariableInitializer">
- <JsGlobalScopeVariableInitializer
- variable="TEST_LIB"
- class="org.eclipse.wst.jsdt.core.tests.model.VariablesInitializer"/>
- <JsGlobalScopeVariableInitializer
- variable="TEST_SRC"
- class="org.eclipse.wst.jsdt.core.tests.model.VariablesInitializer"/>
- <JsGlobalScopeVariableInitializer
- variable="TEST_ROOT"
- class="org.eclipse.wst.jsdt.core.tests.model.VariablesInitializer"/>
- <JsGlobalScopeVariableInitializer
- class="org.eclipse.wst.jsdt.core.tests.model.VariablesInitializer"
- deprecated="%JsGlobalScopeVariableInitializer.deprecated.0"
- variable="TEST_DEPRECATED">
- </JsGlobalScopeVariableInitializer>
- <JsGlobalScopeVariableInitializer
- class="org.eclipse.wst.jsdt.core.tests.model.VariablesInitializer"
- readOnly="true"
- variable="TEST_READ_ONLY">
- </JsGlobalScopeVariableInitializer>
- <JsGlobalScopeVariableInitializer
- class="org.eclipse.wst.jsdt.core.tests.model.VariablesInitializer"
- deprecated="%JsGlobalScopeVariableInitializer.deprecated.1"
- readOnly="true"
- variable="TEST_DEPRECATED_READ_ONLY">
- </JsGlobalScopeVariableInitializer>
- </extension>
-
- <!-- Classpath container initializer -->
- <extension point = "org.eclipse.wst.jsdt.core.JsGlobalScopeContainerInitializer">
- <JsGlobalScopeContainerInitializer
- id="org.eclipse.wst.jsdt.core.tests.model.TEST_CONTAINER"
- class="org.eclipse.wst.jsdt.core.tests.model.ContainerInitializer"/>
- </extension>
-
- <!-- Extra JavaScript-like file extensions -->
- <extension point="org.eclipse.core.contenttype.contentTypes">
- <file-association
- content-type="org.eclipse.wst.jsdt.core.javaSource"
- file-extensions="foo,bar"/>
- </extension>
-
- <!-- Repository provider -->
- <extension point="org.eclipse.team.core.repository">
- <repository
- id="org.eclipse.wst.jsdt.core.tests.model.pessimisticnature"
- class="org.eclipse.wst.jsdt.core.tests.model.TestPessimisticProvider">
- </repository>;
- </extension>
-
- <!-- Compilation participant -->
- <extension point="org.eclipse.wst.jsdt.core.validationParticipant">
- <validationParticipant
- class="org.eclipse.wst.jsdt.core.tests.model.TestvalidationParticipant"
- createsProblems="true"
- id="org.eclipse.wst.jsdt.core.tests.model.validationParticipant"
- requiredSourceLevel="1.4"
- modifiesEnvironment="true">
- <requires id="non.existing"/>
- </validationParticipant>
- </extension>
-
-</plugin>
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java
deleted file mode 100644
index faae149..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunCompilerTests.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-/**
- * Runs all compiler tests (including parser tests) See AbstractCompilerTests
- * for more details.
- */
-public class RunCompilerTests extends TestCase {
-
- public RunCompilerTests(String name) {
- super(name);
- }
-
- public static Class[] getAllTestClasses() {
- return new Class[] {
- org.eclipse.wst.jsdt.core.tests.compiler.regression.TestAll.class,
- org.eclipse.wst.jsdt.core.tests.compiler.parser.TestAll.class };
- }
-
- public static Test suite() {
- TestSuite ts = new TestSuite(RunCompilerTests.class.getName());
-
- Class[] testClasses = getAllTestClasses();
- for (int i = 0; i < testClasses.length; i++) {
- Class testClass = testClasses[i];
-
- // call the suite() method and add the resulting suite to the suite
- try {
- Method suiteMethod = testClass.getDeclaredMethod(
- "suite", new Class[0]); //$NON-NLS-1$
- Test suite = (Test) suiteMethod.invoke(null, new Object[0]);
- ts.addTest(suite);
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.getTargetException().printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- }
- }
- return ts;
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunDOMTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunDOMTests.java
deleted file mode 100644
index 7358ecf..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunDOMTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.wst.jsdt.core.tests.dom.RunAllTests;
-
-/**
- * Runs all DOM AST tests.
- */
-public class RunDOMTests extends TestCase {
-
-public RunDOMTests(String name) {
- super(name);
-}
-public static Test suite() {
- TestSuite suite = new TestSuite(RunDOMTests.class.getName());
- suite.addTest(RunAllTests.suite());
- return suite;
-}
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunFormatterTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunFormatterTests.java
deleted file mode 100644
index 88afcb4..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunFormatterTests.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests;
-
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.wst.jsdt.core.tests.formatter.comment.CommentsTestSuite;
-
-/**
- * Runs all formatter tests.
- */
-public class RunFormatterTests extends TestCase {
-
- public static Class[] getAllTestClasses() {
- return new Class[] {
- //FormatterRegressionTests.class,
- CommentsTestSuite.class,
- };
- }
- public static Test suite() {
- TestSuite ts = new TestSuite(RunFormatterTests.class.getName());
-
- Class[] testClasses = getAllTestClasses();
- for (int i = 0; i < testClasses.length; i++) {
- Class testClass = testClasses[i];
-
- // call the suite() method and add the resulting suite to the suite
- try {
- Method suiteMethod = testClass.getDeclaredMethod("suite", new Class[0]); //$NON-NLS-1$
- Test suite = (Test)suiteMethod.invoke(null, new Object[0]);
- ts.addTest(suite);
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (InvocationTargetException e) {
- e.getTargetException().printStackTrace();
- } catch (NoSuchMethodException e) {
- e.printStackTrace();
- }
- }
- return ts;
- }
-
-public RunFormatterTests(String name) {
- super(name);
-}
-}
-
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunJSDTCoreTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunJSDTCoreTests.java
deleted file mode 100644
index 309911f..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunJSDTCoreTests.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.wst.jsdt.core.tests.utils.SequenceReaderTests;
-
-/**
- * Runs all JDT Core tests.
- */
-public class RunJSDTCoreTests extends TestCase {
-public RunJSDTCoreTests(String name) {
- super(name);
-}
-public static Test suite() {
- TestSuite suite = new TestSuite("JSDT 'Model' Tests");
- suite.addTest(RunDOMTests.suite());
- suite.addTest(RunFormatterTests.suite());
- suite.addTest(RunModelTests.suite());
- suite.addTestSuite(SequenceReaderTests.class);
- return suite;
-}
-}
-
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunModelTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunModelTests.java
deleted file mode 100644
index 1f53b8e..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/RunModelTests.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests;
-
-import junit.framework.Test;
-import junit.framework.TestCase;
-import junit.framework.TestSuite;
-
-import org.eclipse.wst.jsdt.core.tests.model.JSDTModelTests;
-
-/**
- * Runs all Java model tests.
- */
-public class RunModelTests extends TestCase {
-public RunModelTests(String name) {
- super(name);
-}
-public static Test suite() {
- TestSuite suite = new TestSuite(RunModelTests.class.getName());
- suite.addTest(JSDTModelTests.suite());
- return suite;
-}
-}
-
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterAST3Test.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterAST3Test.java
deleted file mode 100644
index 2e407ba..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterAST3Test.java
+++ /dev/null
@@ -1,9467 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.util.List;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.IJavaScriptProject;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTMatcher;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.AbstractTypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ArrayCreation;
-import org.eclipse.wst.jsdt.core.dom.ArrayInitializer;
-import org.eclipse.wst.jsdt.core.dom.ArrayType;
-import org.eclipse.wst.jsdt.core.dom.Assignment;
-import org.eclipse.wst.jsdt.core.dom.Block;
-import org.eclipse.wst.jsdt.core.dom.BodyDeclaration;
-import org.eclipse.wst.jsdt.core.dom.BooleanLiteral;
-import org.eclipse.wst.jsdt.core.dom.BreakStatement;
-import org.eclipse.wst.jsdt.core.dom.CatchClause;
-import org.eclipse.wst.jsdt.core.dom.CharacterLiteral;
-import org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation;
-import org.eclipse.wst.jsdt.core.dom.ConditionalExpression;
-import org.eclipse.wst.jsdt.core.dom.ContinueStatement;
-import org.eclipse.wst.jsdt.core.dom.DoStatement;
-import org.eclipse.wst.jsdt.core.dom.EmptyStatement;
-import org.eclipse.wst.jsdt.core.dom.Expression;
-import org.eclipse.wst.jsdt.core.dom.ExpressionStatement;
-import org.eclipse.wst.jsdt.core.dom.FieldAccess;
-import org.eclipse.wst.jsdt.core.dom.FieldDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ForStatement;
-import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
-import org.eclipse.wst.jsdt.core.dom.IBinding;
-import org.eclipse.wst.jsdt.core.dom.IFunctionBinding;
-import org.eclipse.wst.jsdt.core.dom.IPackageBinding;
-import org.eclipse.wst.jsdt.core.dom.ITypeBinding;
-import org.eclipse.wst.jsdt.core.dom.IVariableBinding;
-import org.eclipse.wst.jsdt.core.dom.IfStatement;
-import org.eclipse.wst.jsdt.core.dom.ImportDeclaration;
-import org.eclipse.wst.jsdt.core.dom.InfixExpression;
-import org.eclipse.wst.jsdt.core.dom.Initializer;
-import org.eclipse.wst.jsdt.core.dom.InstanceofExpression;
-import org.eclipse.wst.jsdt.core.dom.JSdoc;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.LabeledStatement;
-import org.eclipse.wst.jsdt.core.dom.Modifier;
-import org.eclipse.wst.jsdt.core.dom.Name;
-import org.eclipse.wst.jsdt.core.dom.NullLiteral;
-import org.eclipse.wst.jsdt.core.dom.NumberLiteral;
-import org.eclipse.wst.jsdt.core.dom.PackageDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ParenthesizedExpression;
-import org.eclipse.wst.jsdt.core.dom.PostfixExpression;
-import org.eclipse.wst.jsdt.core.dom.PrefixExpression;
-import org.eclipse.wst.jsdt.core.dom.PrimitiveType;
-import org.eclipse.wst.jsdt.core.dom.QualifiedName;
-import org.eclipse.wst.jsdt.core.dom.ReturnStatement;
-import org.eclipse.wst.jsdt.core.dom.SimpleName;
-import org.eclipse.wst.jsdt.core.dom.SimpleType;
-import org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.wst.jsdt.core.dom.Statement;
-import org.eclipse.wst.jsdt.core.dom.StringLiteral;
-import org.eclipse.wst.jsdt.core.dom.SuperConstructorInvocation;
-import org.eclipse.wst.jsdt.core.dom.SuperFieldAccess;
-import org.eclipse.wst.jsdt.core.dom.SuperMethodInvocation;
-import org.eclipse.wst.jsdt.core.dom.SwitchCase;
-import org.eclipse.wst.jsdt.core.dom.SwitchStatement;
-import org.eclipse.wst.jsdt.core.dom.ThisExpression;
-import org.eclipse.wst.jsdt.core.dom.ThrowStatement;
-import org.eclipse.wst.jsdt.core.dom.TryStatement;
-import org.eclipse.wst.jsdt.core.dom.Type;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.TypeLiteral;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.WhileStatement;
-import org.eclipse.wst.jsdt.core.util.IModifierConstants;
-
-public class ASTConverterAST3Test extends ConverterTestSetup {
-
- public void setUpSuite() throws Exception {
- super.setUpSuite();
- this.ast = AST.newAST(AST.JLS3);
- }
-
- public ASTConverterAST3Test(String name) {
- super(name);
- }
-
- static {
- }
-
- public static Test suite() {
- return buildModelTestSuite(ASTConverterAST3Test.class);
- }
-
- public void test0001() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0001", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
-
- // check that we have the right tree
- JavaScriptUnit unit = this.ast.newJavaScriptUnit();
- FunctionDeclaration methodDeclaration = this.ast.newFunctionDeclaration();
- methodDeclaration.setConstructor(false);
- methodDeclaration.setName(this.ast.newSimpleName("main"));//$NON-NLS-1$
- SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration();
- variableDeclaration.setName(this.ast.newSimpleName("args"));//$NON-NLS-1$
- methodDeclaration.parameters().add(variableDeclaration);
- org.eclipse.wst.jsdt.core.dom.Block block = this.ast.newBlock();
- FunctionInvocation methodInvocation = this.ast.newFunctionInvocation();
- methodInvocation.setName(this.ast.newSimpleName("print")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();
- literal.setLiteralValue("Hello");//$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();
- literal.setLiteralValue(" world");//$NON-NLS-1$
- infixExpression.setRightOperand(literal);//$NON-NLS-1$
- methodInvocation.arguments().add(infixExpression);
- ExpressionStatement expressionStatement = this.ast.newExpressionStatement(methodInvocation);
- block.statements().add(expressionStatement);
- methodDeclaration.setBody(block);
- assertTrue("Both AST trees should be identical", result.subtreeMatch(new ASTMatcher(), unit));//$NON-NLS-1$
- String expected =
- "function main(args) {\n" +
- " print(\"Hello\" + \" world\");\n" +
- "}";
- checkSourceRange(result, expected, source);
- }
-
- /**
- * Test allocation expression: new Object() ==> ClassInstanceCreation
- */
- public void test0002() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0002", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- classInstanceCreation.setType(this.ast.newSimpleType(this.ast.newSimpleName("Object"))); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new Object()", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new java.lang.Object() ==> ClassInstanceCreation
- */
- public void test0003() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0003", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newQualifiedName(
- this.ast.newSimpleName("java"), //$NON-NLS-1$
- this.ast.newSimpleName("lang")), //$NON-NLS-1$
- this.ast.newSimpleName("Object"));//$NON-NLS-1$
- classInstanceCreation.setType(this.ast.newSimpleType(name));
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new java.lang.Object()", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new java.lang.Exception("ERROR") ==> ClassInstanceCreation
- */
- public void test0004() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0004", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newQualifiedName(
- this.ast.newSimpleName("java"), //$NON-NLS-1$
- this.ast.newSimpleName("lang")), //$NON-NLS-1$
- this.ast.newSimpleName("Exception"));//$NON-NLS-1$
- classInstanceCreation.setType(this.ast.newSimpleType(name));
- StringLiteral literal = this.ast.newStringLiteral();
- literal.setLiteralValue("ERROR"); //$NON-NLS-1$
- classInstanceCreation.arguments().add(literal);
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new java.lang.Exception(\"ERROR\")", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new java.lang.Object() {} ==> ClassInstanceCreation
- */
- public void test0005() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0005", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newQualifiedName(
- this.ast.newSimpleName("java"), //$NON-NLS-1$
- this.ast.newSimpleName("lang")), //$NON-NLS-1$
- this.ast.newSimpleName("Object"));//$NON-NLS-1$
- classInstanceCreation.setType(this.ast.newSimpleType(name));
- AnonymousClassDeclaration anonymousClassDeclaration = this.ast.newAnonymousClassDeclaration();
- classInstanceCreation.setAnonymousClassDeclaration(anonymousClassDeclaration);
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new java.lang.Object() {}", source); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation2 = (ClassInstanceCreation) expression;
- Type type = classInstanceCreation2.getType();
- checkSourceRange(type, "java.lang.Object", source); //$NON-NLS-1$
- }
-
-
- /**
- * Test allocation expression: new java.lang.Runnable() { public void run() {}} ==> ClassInstanceCreation
- */
- public void test0006() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0006", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newQualifiedName(
- this.ast.newSimpleName("java"), //$NON-NLS-1$
- this.ast.newSimpleName("lang")), //$NON-NLS-1$
- this.ast.newSimpleName("Runnable"));//$NON-NLS-1$
- classInstanceCreation.setType(this.ast.newSimpleType(name));
- FunctionDeclaration methodDeclaration = this.ast.newFunctionDeclaration();
- methodDeclaration.setBody(this.ast.newBlock());
- methodDeclaration.setConstructor(false);
- methodDeclaration.modifiers().add(this.ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
- methodDeclaration.setName(this.ast.newSimpleName("run"));//$NON-NLS-1$
- methodDeclaration.setReturnType2(this.ast.newPrimitiveType(PrimitiveType.VOID));
- AnonymousClassDeclaration anonymousClassDeclaration = this.ast.newAnonymousClassDeclaration();
- anonymousClassDeclaration.bodyDeclarations().add(methodDeclaration);
- classInstanceCreation.setAnonymousClassDeclaration(anonymousClassDeclaration);
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new java.lang.Runnable() { public void run() {}}", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new Test().new D() ==> ClassInstanceCreation
- */
- public void test0007() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0007", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- ASTNode expression = (ASTNode) ((FunctionInvocation) expressionStatement.getExpression()).arguments().get(0);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- classInstanceCreation.setType(this.ast.newSimpleType(this.ast.newSimpleName("D"))); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreationExpression = this.ast.newClassInstanceCreation();
- classInstanceCreationExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("Test"))); //$NON-NLS-1$
- classInstanceCreation.setExpression(classInstanceCreationExpression);
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new Test().new D()", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new int[] {1, 2, 3, 4} ==> ArrayCreation
- */
- public void test0008() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0008", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ArrayCreation arrayCreation = this.ast.newArrayCreation();
- arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1));
- ArrayInitializer arrayInitializer = this.ast.newArrayInitializer();
- arrayInitializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$
- arrayInitializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- arrayInitializer.expressions().add(this.ast.newNumberLiteral("3"));//$NON-NLS-1$
- arrayInitializer.expressions().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$
- arrayCreation.setInitializer(arrayInitializer);
- assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new int[] {1, 2, 3, 4}", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new int[][] {{1}, {2}} ==> ArrayCreation
- */
- public void test0009() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0009", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ArrayCreation arrayCreation = this.ast.newArrayCreation();
- arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 2));
- ArrayInitializer arrayInitializer = this.ast.newArrayInitializer();
- ArrayInitializer innerArrayInitializer = this.ast.newArrayInitializer();
- innerArrayInitializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$
- arrayInitializer.expressions().add(innerArrayInitializer);
- innerArrayInitializer = this.ast.newArrayInitializer();
- innerArrayInitializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- arrayInitializer.expressions().add(innerArrayInitializer);
- arrayCreation.setInitializer(arrayInitializer);
- assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new int[][] {{1}, {2}}", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new int[3] ==> ArrayCreation
- */
- public void test0010() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0010", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ArrayCreation arrayCreation = this.ast.newArrayCreation();
- arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1));
- arrayCreation.dimensions().add(this.ast.newNumberLiteral("3")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new int[3]", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new int[3][] ==> ArrayCreation
- */
- public void test0011() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0011", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ArrayCreation arrayCreation = this.ast.newArrayCreation();
- arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 2));
- arrayCreation.dimensions().add(this.ast.newNumberLiteral("3")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new int[3][]", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new int[][] {{},{}} ==> ArrayCreation
- */
- public void test0012() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0012", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ArrayCreation arrayCreation = this.ast.newArrayCreation();
- arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 2));
- ArrayInitializer arrayInitializer = this.ast.newArrayInitializer();
- ArrayInitializer innerArrayInitializer = this.ast.newArrayInitializer();
- arrayInitializer.expressions().add(innerArrayInitializer);
- innerArrayInitializer = this.ast.newArrayInitializer();
- arrayInitializer.expressions().add(innerArrayInitializer);
- arrayCreation.setInitializer(arrayInitializer);
- assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new int[][] {{}, {}}", source); //$NON-NLS-1$
- }
-
- /**
- * int i; ==> VariableDeclarationFragment
- */
- public void test0013() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0013", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i;", source); //$NON-NLS-1$
- }
-
- /**
- * int i = 0; ==> VariableDeclarationFragment
- */
- public void test0014() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0014", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i = 0;", source); //$NON-NLS-1$
- }
-
- /**
- * i = 1; ==> ExpressionStatement(Assignment)
- */
- public void test0015() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0015", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("1")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i = 1;", source); //$NON-NLS-1$
- }
-
- /**
- * i += 2; ==> ExpressionStatement(Assignment)
- */
- public void test0016() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0016", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.PLUS_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i += 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i -= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0017() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0017", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.MINUS_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i -= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i *= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0018() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0018", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.TIMES_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i *= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i /= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0019() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0019", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.DIVIDE_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i /= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i &= 2 ==> ExpressionStatement(Assignment)
- */
- public void test0020() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0020", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.BIT_AND_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i &= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i |= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0021() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0021", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.BIT_OR_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i |= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i ^= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0022() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0022", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.BIT_XOR_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i ^= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i %= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0023() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0023", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.REMAINDER_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i %= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i <<= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0024() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0024", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.LEFT_SHIFT_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i <<= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i >>= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0025() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0025", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i >>= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i >>>= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0026() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0026", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i >>>= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * --i; ==> ExpressionStatement(PrefixExpression)
- */
- public void test0027() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0027", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- prefixExpression.setOperator(PrefixExpression.Operator.DECREMENT);//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(prefixExpression);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "--i;", source); //$NON-NLS-1$
- }
-
- /**
- * --i; ==> ExpressionStatement(PrefixExpression)
- */
- public void test0028() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0028", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT);//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(prefixExpression);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "++i;", source); //$NON-NLS-1$
- }
-
- /**
- * i--; ==> ExpressionStatement(PostfixExpression)
- */
- public void test0029() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0029", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.DECREMENT);//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(postfixExpression);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i--;", source); //$NON-NLS-1$
- }
-
- /**
- * i++; ==> ExpressionStatement(PostfixExpression)
- */
- public void test0030() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0030", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(postfixExpression);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i++;", source); //$NON-NLS-1$
- }
-
- /**
- * int.class; ==> ExpressionStatement(TypeLiteral)
- */
- public void test0038() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0038", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$
- TypeLiteral typeLiteral = this.ast.newTypeLiteral();
- typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- variableDeclarationFragment.setInitializer(typeLiteral);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "int.class", source); //$NON-NLS-1$
- }
-
- /**
- * void.class; ==> ExpressionStatement(TypeLiteral)
- */
- public void test0039() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0039", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$
- TypeLiteral typeLiteral = this.ast.newTypeLiteral();
- typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.VOID));
- variableDeclarationFragment.setInitializer(typeLiteral);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "void.class", source); //$NON-NLS-1$
- }
-
- /**
- * double.class; ==> ExpressionStatement(TypeLiteral)
- */
- public void test0040() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0040", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$
- TypeLiteral typeLiteral = this.ast.newTypeLiteral();
- typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.DOUBLE));
- variableDeclarationFragment.setInitializer(typeLiteral);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "double.class", source); //$NON-NLS-1$
- }
-
- /**
- * long.class; ==> ExpressionStatement(TypeLiteral)
- */
- public void test0041() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0041", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$
- TypeLiteral typeLiteral = this.ast.newTypeLiteral();
- typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.LONG));
- variableDeclarationFragment.setInitializer(typeLiteral);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "long.class", source); //$NON-NLS-1$
- }
-
- /**
- * false ==> BooleanLiteral
- */
- public void test0042() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0042", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- BooleanLiteral literal = this.ast.newBooleanLiteral(false);
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "false", source); //$NON-NLS-1$
- }
-
- /**
- * true ==> BooleanLiteral
- */
- public void test0043() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0043", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- BooleanLiteral literal = this.ast.newBooleanLiteral(true);
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "true", source); //$NON-NLS-1$
- }
-
- /**
- * null ==> NullLiteral
- */
- public void test0044() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0044", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NullLiteral literal = this.ast.newNullLiteral();
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "null", source); //$NON-NLS-1$
- }
-
- /**
- * CharLiteral ==> CharacterLiteral
- */
- public void test0045() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0045", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- CharacterLiteral literal = this.ast.newCharacterLiteral();
- literal.setEscapedValue("'c'"); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "'c'", source); //$NON-NLS-1$
- }
-
- /**
- * DoubleLiteral ==> NumberLiteral
- */
- public void test0046() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0046", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("1.00001");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "1.00001", source); //$NON-NLS-1$
- }
-
- /**
- * FloatLiteral ==> NumberLiteral
- */
- public void test0047() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0047", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("1.00001f");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "1.00001f", source); //$NON-NLS-1$
- }
-
- /**
- * IntLiteral ==> NumberLiteral
- */
- public void test0048() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0048", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("30000");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "30000", source); //$NON-NLS-1$
- }
-
- /**
- * IntLiteralMinValue ==> NumberLiteral
- */
- public void test0049() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0049", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("-2147483648");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "-2147483648", source); //$NON-NLS-1$
- }
-
- /**
- * LongLiteral ==> NumberLiteral
- */
- public void test0050() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0050", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("2147483648L");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "2147483648L", source); //$NON-NLS-1$
- }
-
- /**
- * LongLiteral ==> NumberLiteral (negative value)
- */
- public void test0051() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0051", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("2147483648L");//$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperand(literal);
- prefixExpression.setOperator(PrefixExpression.Operator.MINUS);
- assertTrue("Both AST trees should be identical", prefixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "-2147483648L", source); //$NON-NLS-1$
- }
-
- /**
- * LongLiteralMinValue ==> NumberLiteral
- */
- public void test0052() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0052", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("-9223372036854775808L");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "-9223372036854775808L", source); //$NON-NLS-1$
- }
-
- /**
- * ExtendedStringLiteral ==> StringLiteral
- */
- public void test0053() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0053", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- /*
- StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("Hello World");*/
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();
- literal.setLiteralValue("Hello");//$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();
- literal.setLiteralValue(" World");//$NON-NLS-1$
- infixExpression.setRightOperand(literal);//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"Hello\" + \" World\"", source); //$NON-NLS-1$
- }
-
- /**
- * AND_AND_Expression ==> InfixExpression
- */
- public void test0054() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0054", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.CONDITIONAL_AND);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b3 = b && b2;", source); //$NON-NLS-1$
- }
-
- /**
- * OR_OR_Expression ==> InfixExpression
- */
- public void test0055() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0055", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.CONDITIONAL_OR);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b3 = b || b2;", source); //$NON-NLS-1$
- }
-
- /**
- * EqualExpression ==> InfixExpression
- */
- public void test0056() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0056", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.EQUALS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b3 = b == b2;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (+) ==> InfixExpression
- */
- public void test0057() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0057", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i + j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (-) ==> InfixExpression
- */
- public void test0058() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0058", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.MINUS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i - j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (*) ==> InfixExpression
- */
- public void test0059() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0059", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.TIMES);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i * j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (/) ==> InfixExpression
- */
- public void test0060() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0060", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.DIVIDE);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i / j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (%) ==> InfixExpression
- */
- public void test0061() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0061", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.REMAINDER);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i % j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (^) ==> InfixExpression
- */
- public void test0062() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0062", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.XOR);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i ^ j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (&) ==> InfixExpression
- */
- public void test0063() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0063", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.AND);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i & j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (|) ==> InfixExpression
- */
- public void test0064() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0064", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.OR);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = i | j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (<) ==> InfixExpression
- */
- public void test0065() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0065", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b2 = b < b1;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (<=) ==> InfixExpression
- */
- public void test0066() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0066", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS_EQUALS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b2 = b <= b1;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (>) ==> InfixExpression
- */
- public void test0067() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0067", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.GREATER);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b2 = b > b1;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (>=) ==> InfixExpression
- */
- public void test0068() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0068", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.GREATER_EQUALS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b2 = b >= b1;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (!=) ==> InfixExpression
- */
- public void test0069() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0069", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.NOT_EQUALS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b2 = b != b1;", source); //$NON-NLS-1$
- }
-
- /**
- * InstanceofExpression ==> InfixExpression
- */
- public void test0070() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0070", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$
- InstanceofExpression instanceOfExpression = this.ast.newInstanceofExpression();
- instanceOfExpression.setLeftOperand(this.ast.newSimpleName("o"));//$NON-NLS-1$
- SimpleType simpleType = this.ast.newSimpleType(this.ast.newSimpleName("Integer"));//$NON-NLS-1$
- instanceOfExpression.setRightOperand(simpleType);
- variableDeclarationFragment.setInitializer(instanceOfExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b = o instanceof Integer;", source); //$NON-NLS-1$
- }
-
- /**
- * InstanceofExpression ==> InfixExpression
- */
- public void test0071() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0071", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$
- InstanceofExpression instanceOfExpression = this.ast.newInstanceofExpression();
- instanceOfExpression.setLeftOperand(this.ast.newSimpleName("o")); //$NON-NLS-1$
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newQualifiedName(
- this.ast.newSimpleName("java"), //$NON-NLS-1$
- this.ast.newSimpleName("lang")), //$NON-NLS-1$
- this.ast.newSimpleName("Integer")); //$NON-NLS-1$
- Type type = ast.newSimpleType(name);
- instanceOfExpression.setRightOperand(type);
- variableDeclarationFragment.setInitializer(instanceOfExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b = o instanceof java.lang.Integer;", source); //$NON-NLS-1$
- }
-
- /**
- * UnaryExpression (!) ==> PrefixExpression
- */
- public void test0072() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0072", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperator(PrefixExpression.Operator.NOT);
- prefixExpression.setOperand(this.ast.newSimpleName("b"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(prefixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b1 = !b;", source); //$NON-NLS-1$
- }
-
- /**
- * UnaryExpression (~) ==> PrefixExpression
- */
- public void test0073() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0073", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperator(PrefixExpression.Operator.COMPLEMENT);
- prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(prefixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int n = ~i;", source); //$NON-NLS-1$
- }
-
- /**
- * UnaryExpression (+) ==> PrefixExpression
- */
- public void test0074() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0074", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperator(PrefixExpression.Operator.PLUS);
- prefixExpression.setOperand(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(prefixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i = +2;", source); //$NON-NLS-1$
- }
-
- /**
- * UnaryExpression (-) ==> PrefixExpression
- */
- public void test0075() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0075", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperator(PrefixExpression.Operator.MINUS);
- prefixExpression.setOperand(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(prefixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i = -2;", source); //$NON-NLS-1$
- }
-
- /**
- * ConditionalExpression ==> ConditionalExpression
- */
- public void test0076() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0076", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$
- ConditionalExpression conditionalExpression = this.ast.newConditionalExpression();
- InfixExpression condition = this.ast.newInfixExpression();
- condition.setLeftOperand(this.ast.newSimpleName("args")); //$NON-NLS-1$
- condition.setRightOperand(this.ast.newNullLiteral()); //$NON-NLS-1$
- condition.setOperator(InfixExpression.Operator.NOT_EQUALS);
- conditionalExpression.setExpression(condition);
- conditionalExpression.setThenExpression(this.ast.newBooleanLiteral(true));
- conditionalExpression.setElseExpression(this.ast.newBooleanLiteral(false));
- variableDeclarationFragment.setInitializer(conditionalExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "boolean b = args != null ? true : false;", source); //$NON-NLS-1$
- }
-
- /**
- * ConditionalExpression ==> ConditionalExpression
- */
- public void test0077() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0077", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- ConditionalExpression conditionalExpression = this.ast.newConditionalExpression();
- conditionalExpression.setExpression(this.ast.newBooleanLiteral(true));
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newSimpleName("args"), //$NON-NLS-1$
- this.ast.newSimpleName("length")); //$NON-NLS-1$
- conditionalExpression.setThenExpression(name);
- conditionalExpression.setElseExpression(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(conditionalExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i = true ? args.length: 0;", source); //$NON-NLS-1$
- }
-
- /**
- * MessageSend ==> SuperMethodInvocation
- */
- public void test0078() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0078", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- SuperMethodInvocation superMethodInvocation = this.ast.newSuperMethodInvocation();
- superMethodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(superMethodInvocation);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "super.bar();", source); //$NON-NLS-1$
- }
-
- /**
- * MessageSend ==> SuperMethodInvocation
- */
- public void test0079() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0079", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- SuperMethodInvocation superMethodInvocation = this.ast.newSuperMethodInvocation();
- superMethodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$
- superMethodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(superMethodInvocation);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "super.bar(4);", source); //$NON-NLS-1$
- }
-
- /**
- * MessageSend ==> FunctionInvocation
- */
- public void test0080() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0080", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- FunctionInvocation methodInvocation = this.ast.newFunctionInvocation();
- methodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$
- methodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(methodInvocation);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "bar(4);", source); //$NON-NLS-1$
- }
-
- /**
- * MessageSend ==> FunctionInvocation
- */
- public void test0081() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0081", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- FunctionInvocation methodInvocation = this.ast.newFunctionInvocation();
- methodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$
- methodInvocation.setExpression(this.ast.newThisExpression());
- methodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(methodInvocation);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "this.bar(4);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0082() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0082", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (;;);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0083() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0083", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- forStatement.initializers().add(variableDeclarationExpression);
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- forStatement.setBody(this.ast.newBlock());
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$
- forStatement.setExpression(infixExpression);
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (int i = 0; i < 10; i++) {}", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0084() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0084", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
-
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- forStatement.initializers().add(variableDeclarationExpression);
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$
- forStatement.setExpression(infixExpression);
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (int i = 0; i < 10; i++);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0085() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0085", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
-
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- forStatement.initializers().add(variableDeclarationExpression);
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (int i = 0;; i++);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0086() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0086", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$
- forStatement.setExpression(infixExpression);
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (; i < 10; i++);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0087() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0087", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (;;i++);", source); //$NON-NLS-1$
- }
-
- /**
- * LocalDeclaration ==> VariableDeclarationStatement
- */
- public void test0088() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0088", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
-
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i;", source); //$NON-NLS-1$
- }
-
- /**
- * LocalDeclaration ==> VariableDeclarationStatement
- */
- public void test0089() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0089", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$
-
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newQualifiedName(
- this.ast.newSimpleName("java"),//$NON-NLS-1$
- this.ast.newSimpleName("lang")//$NON-NLS-1$
- ),
- this.ast.newSimpleName("String") //$NON-NLS-1$
- );
- statement.setType(this.ast.newSimpleType(name));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "java.lang.String s;", source); //$NON-NLS-1$
- }
-
- /**
- * LocalDeclaration ==> VariableDeclarationStatement
- */
- public void test0090() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0090", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- ArrayInitializer initializer = this.ast.newArrayInitializer();
- initializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$
- initializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(initializer);
- variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$
-
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1));
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int[] tab = {1, 2};", source); //$NON-NLS-1$
- }
-
- /**
- * Argument ==> SingleVariableDeclaration
- */
- public void test0091() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0091", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- FunctionDeclaration method = (FunctionDeclaration)((TypeDeclaration) ((JavaScriptUnit) result).types().get(0)).bodyDeclarations().get(0);
- SingleVariableDeclaration node = (SingleVariableDeclaration) method.parameters().get(0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration();
- variableDeclaration.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
- variableDeclaration.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", variableDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "String s", source); //$NON-NLS-1$
- }
-
- /**
- * Argument ==> SingleVariableDeclaration
- */
- public void test0092() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0092", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- FunctionDeclaration method = (FunctionDeclaration)((TypeDeclaration) ((JavaScriptUnit) result).types().get(0)).bodyDeclarations().get(0);
- SingleVariableDeclaration node = (SingleVariableDeclaration) method.parameters().get(0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration();
- variableDeclaration.modifiers().add(this.ast.newModifier(Modifier.ModifierKeyword.FINAL_KEYWORD));
- variableDeclaration.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
- variableDeclaration.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", variableDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "final String s", source); //$NON-NLS-1$
- assertEquals("Wrong dimension", 0, node.getExtraDimensions()); //$NON-NLS-1$
- }
-
- /**
- * Break ==> BreakStatement
- */
- public void test0093() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0093", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- ForStatement forStatement = (ForStatement) node;
- BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- BreakStatement breakStatement = this.ast.newBreakStatement();
- assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "break;", source); //$NON-NLS-1$
- }
-
- /**
- * Continue ==> ContinueStatement
- */
- public void test0094() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0094", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- ForStatement forStatement = (ForStatement) node;
- ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- ContinueStatement continueStatement = this.ast.newContinueStatement();
- assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "continue;", source); //$NON-NLS-1$
- }
-
- /**
- * Continue with Label ==> ContinueStatement
- */
- public void test0095() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0095", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0);
- ForStatement forStatement = (ForStatement) labeledStatement.getBody();
- ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- ContinueStatement continueStatement = this.ast.newContinueStatement();
- continueStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "continue label;", source); //$NON-NLS-1$
- }
-
- /**
- * Break + label ==> BreakStatement
- */
- public void test0096() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0096", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0);
- ForStatement forStatement = (ForStatement) labeledStatement.getBody();
- BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- BreakStatement breakStatement = this.ast.newBreakStatement();
- breakStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "break label;", source); //$NON-NLS-1$
- }
-
- /**
- * SwitchStatement ==> SwitchStatement
- */
- public void test0097() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0097", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- SwitchStatement switchStatement = this.ast.newSwitchStatement();
- switchStatement.setExpression(this.ast.newSimpleName("i"));//$NON-NLS-1$
- SwitchCase _case = this.ast.newSwitchCase();
- _case.setExpression(this.ast.newNumberLiteral("1"));//$NON-NLS-1$
- switchStatement.statements().add(_case);
- switchStatement.statements().add(this.ast.newBreakStatement());
- _case = this.ast.newSwitchCase();
- _case.setExpression(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- switchStatement.statements().add(_case);
- FunctionInvocation methodInvocation = this.ast.newFunctionInvocation();
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newSimpleName("System"),//$NON-NLS-1$
- this.ast.newSimpleName("out"));//$NON-NLS-1$
- methodInvocation.setExpression(name);
- methodInvocation.setName(this.ast.newSimpleName("println")); //$NON-NLS-1$
- methodInvocation.arguments().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- ExpressionStatement expressionStatement = this.ast.newExpressionStatement(methodInvocation);
- switchStatement.statements().add(expressionStatement);
- switchStatement.statements().add(this.ast.newBreakStatement());
- _case = this.ast.newSwitchCase();
- _case.setExpression(null);
- switchStatement.statements().add(_case);
- methodInvocation = this.ast.newFunctionInvocation();
- name =
- this.ast.newQualifiedName(
- this.ast.newSimpleName("System"),//$NON-NLS-1$
- this.ast.newSimpleName("out"));//$NON-NLS-1$
- methodInvocation.setExpression(name);
- methodInvocation.setName(this.ast.newSimpleName("println")); //$NON-NLS-1$
- StringLiteral literal = this.ast.newStringLiteral();
- literal.setLiteralValue("default"); //$NON-NLS-1$
- methodInvocation.arguments().add(literal);
- expressionStatement = this.ast.newExpressionStatement(methodInvocation);
- switchStatement.statements().add(expressionStatement);
- assertTrue("Both AST trees should be identical", switchStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "switch(i) {\n" +//$NON-NLS-1$
- " case 1: \n" +//$NON-NLS-1$
- " break;\n" +//$NON-NLS-1$
- " case 2:\n" +//$NON-NLS-1$
- " System.out.println(2);\n" +//$NON-NLS-1$
- " break;\n" +//$NON-NLS-1$
- " default:\n" +//$NON-NLS-1$
- " System.out.println(\"default\");\n" +//$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- SwitchStatement switchStatement2 = (SwitchStatement) node;
- List statements = switchStatement2.statements();
- assertEquals("wrong size", 7, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(5);
- assertTrue("Not a case statement", stmt instanceof SwitchCase); //$NON-NLS-1$
- SwitchCase switchCase = (SwitchCase) stmt;
- assertTrue("Not the default case", switchCase.isDefault()); //$NON-NLS-1$
- }
-
- /**
- * EmptyStatement ==> EmptyStatement
- */
- public void test0098() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0098", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- EmptyStatement emptyStatement = this.ast.newEmptyStatement();
- assertTrue("Both AST trees should be identical", emptyStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, ";", source); //$NON-NLS-1$
- }
-
- /**
- * DoStatement ==> DoStatement
- */
- public void test0099() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0099", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- DoStatement doStatement = this.ast.newDoStatement();
- Block block = this.ast.newBlock();
- block.statements().add(this.ast.newEmptyStatement());
- doStatement.setBody(block);
- doStatement.setExpression(this.ast.newBooleanLiteral(true));
- assertTrue("Both AST trees should be identical", doStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "do {;\n" +//$NON-NLS-1$
- " } while(true);";//$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * WhileStatement ==> WhileStatement
- */
- public void test0100() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0100", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- WhileStatement whileStatement = this.ast.newWhileStatement();
- whileStatement.setExpression(this.ast.newBooleanLiteral(true));
- whileStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", whileStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "while(true);", source);//$NON-NLS-1$
- }
-
- /**
- * WhileStatement ==> WhileStatement
- */
- public void test0101() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0101", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- WhileStatement whileStatement = this.ast.newWhileStatement();
- whileStatement.setExpression(this.ast.newBooleanLiteral(true));
- whileStatement.setBody(this.ast.newBlock());
- assertTrue("Both AST trees should be identical", whileStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "while(true) {}", source);//$NON-NLS-1$
- }
-
- /**
- * ExtendedStringLiteral ==> StringLiteral
- */
- public void test0102() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0102", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("Hello"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue(" World"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("!"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\"", source);//$NON-NLS-1$
- }
-
- /**
- * ExtendedStringLiteral ==> StringLiteral
- */
- public void test0103() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0103", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("Hello"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue(" World"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("!"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("!"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\" + \"!\"", source);//$NON-NLS-1$
- }
-
- /**
- * ExtendedStringLiteral ==> StringLiteral
- */
- public void test0104() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0104", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("Hello"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue(" World"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("!"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- NumberLiteral numberLiteral = this.ast.newNumberLiteral();//$NON-NLS-1$
- numberLiteral.setToken("4"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(numberLiteral);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\" + 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0105() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0105", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "4 + 5 + 6 + 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0106() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0106", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.MINUS);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
-
- InfixExpression infixExpression2 = this.ast.newInfixExpression();
- infixExpression2.setOperator(InfixExpression.Operator.PLUS);
- infixExpression2.setLeftOperand(infixExpression);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression2.setRightOperand(literal);
-
- InfixExpression infixExpression3 = this.ast.newInfixExpression();
- infixExpression3.setOperator(InfixExpression.Operator.PLUS);
- infixExpression3.setLeftOperand(infixExpression2);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression3.setRightOperand(literal);
-
- assertTrue("Both AST trees should be identical", infixExpression3.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "4 - 5 + 6 + 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0107() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0107", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.MINUS);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "4 - 5 - 6 - 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0108() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0108", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral stringLiteral = this.ast.newStringLiteral();//$NON-NLS-1$
- stringLiteral.setLiteralValue("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(stringLiteral);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"4\" + 5 + 6 + 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0109() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0109", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.MINUS);
- StringLiteral stringLiteral = this.ast.newStringLiteral();//$NON-NLS-1$
- stringLiteral.setLiteralValue("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(stringLiteral);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
-
- InfixExpression infixExpression2 = this.ast.newInfixExpression();
- infixExpression2.setOperator(InfixExpression.Operator.PLUS);
- infixExpression2.setLeftOperand(infixExpression);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression2.setRightOperand(literal);
-
- InfixExpression infixExpression3 = this.ast.newInfixExpression();
- infixExpression3.setOperator(InfixExpression.Operator.PLUS);
- infixExpression3.setLeftOperand(infixExpression2);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression3.setRightOperand(literal);
-
- assertTrue("Both AST trees should be identical", infixExpression3.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"4\" - 5 + 6 + 4", source);//$NON-NLS-1$
- }
-
- /**
- * ReturnStatement ==> ReturnStatement
- */
- public void test0110() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0110", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- assertTrue("Both AST trees should be identical", returnStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "return 2;", source);//$NON-NLS-1$
- }
-
- /**
- * ReturnStatement ==> ReturnStatement
- */
- public void test0111() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0111", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- assertTrue("Both AST trees should be identical", returnStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "return 2\\u003B", source);//$NON-NLS-1$
- }
-
-
-
- /**
- * TryStatement ==> TryStatement
- */
- public void test0113() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0113", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- TryStatement tryStatement = this.ast.newTryStatement();
- tryStatement.setBody(this.ast.newBlock());
- tryStatement.setFinally(this.ast.newBlock());
- CatchClause catchBlock = this.ast.newCatchClause();
- catchBlock.setBody(this.ast.newBlock());
- SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration();
- exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$
- exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$
- catchBlock.setException(exceptionVariable);
- tryStatement.catchClauses().add(catchBlock);
- assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "try {\n" +//$NON-NLS-1$
- " } catch(Exception e) {\n" +//$NON-NLS-1$
- " } finally {\n" +//$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * TryStatement ==> TryStatement
- */
- public void test0114() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0114", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- TryStatement tryStatement = this.ast.newTryStatement();
- tryStatement.setBody(this.ast.newBlock());
- CatchClause catchBlock = this.ast.newCatchClause();
- catchBlock.setBody(this.ast.newBlock());
- SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration();
- exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$
- exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$
- catchBlock.setException(exceptionVariable);
- tryStatement.catchClauses().add(catchBlock);
- assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "try {\n" +//$NON-NLS-1$
- " } catch(Exception e) {\n" +//$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * TryStatement ==> TryStatement
- */
- public void test0115() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0115", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- TryStatement tryStatement = this.ast.newTryStatement();
- Block block = this.ast.newBlock();
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- block.statements().add(returnStatement);
- tryStatement.setBody(block);
- CatchClause catchBlock = this.ast.newCatchClause();
- catchBlock.setBody(this.ast.newBlock());
- SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration();
- exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$
- exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$
- catchBlock.setException(exceptionVariable);
- tryStatement.catchClauses().add(catchBlock);
- assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "try {\n" +//$NON-NLS-1$
- " return 2;\n" +//$NON-NLS-1$
- " } catch(Exception e) {\n" +//$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * ThrowStatement ==> ThrowStatement
- */
- public void test0116() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0116", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ThrowStatement throwStatement = this.ast.newThrowStatement();
- throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "throw e \\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * ThrowStatement ==> ThrowStatement
- */
- public void test0117() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0117", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ThrowStatement throwStatement = this.ast.newThrowStatement();
- throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "throw e /* comment in the middle of a throw */ \\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * ThrowStatement ==> ThrowStatement
- */
- public void test0118() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0118", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ThrowStatement throwStatement = this.ast.newThrowStatement();
- throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "throw e /* comment in the middle of a throw */ \\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0119() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0119", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ifStatement.setThenStatement(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "if (true)\\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0120() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0120", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ifStatement.setThenStatement(this.ast.newEmptyStatement());
- ifStatement.setElseStatement(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "if (true)\\u003B\n" +//$NON-NLS-1$
- "\t\telse ;"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0121() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0121", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ifStatement.setThenStatement(this.ast.newBlock());
- ifStatement.setElseStatement(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "if (true) {}\n" +//$NON-NLS-1$
- " else ;"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0122() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0122", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- ifStatement.setThenStatement(returnStatement);
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "if (true) return 2\\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0123() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0123", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- ifStatement.setThenStatement(returnStatement);
- returnStatement = this.ast.newReturnStatement();
- literal = this.ast.newNumberLiteral();
- literal.setToken("3");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- ifStatement.setElseStatement(returnStatement);
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "if (true) return 2;\n" +//$NON-NLS-1$
- " else return 3;"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * Multiple local declaration => VariabledeclarationStatement
- */
- public void test0124() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0124", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("x"));//$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("10");//$NON-NLS-1$
- fragment.setInitializer(literal);
- fragment.setExtraDimensions(0);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("z"));//$NON-NLS-1$
- fragment.setInitializer(this.ast.newNullLiteral());
- fragment.setExtraDimensions(1);
- statement.fragments().add(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$
- fragment.setExtraDimensions(0);
- statement.fragments().add(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$
- fragment.setExtraDimensions(2);
- statement.fragments().add(fragment);
- statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((VariableDeclarationStatement) node).fragments().toArray(new VariableDeclarationFragment[4]);
- assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$
- checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$
- checkSourceRange(fragments[1], "z[] = null", source);//$NON-NLS-1$
- checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$
- checkSourceRange(fragments[3], "j[][]", source);//$NON-NLS-1$
- checkSourceRange(node, "int x= 10, z[] = null, i, j[][];", source);//$NON-NLS-1$
- }
-
- /**
- * Multiple local declaration => VariabledeclarationStatement
- */
- public void test0125() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0125", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("x"));//$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("10");//$NON-NLS-1$
- fragment.setInitializer(literal);
- fragment.setExtraDimensions(0);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("z"));//$NON-NLS-1$
- fragment.setInitializer(this.ast.newNullLiteral());
- fragment.setExtraDimensions(1);
- statement.fragments().add(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$
- fragment.setExtraDimensions(0);
- statement.fragments().add(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$
- fragment.setExtraDimensions(2);
- statement.fragments().add(fragment);
- statement.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1));
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int[] x= 10, z[] = null, i, j[][];", source); //$NON-NLS-1$
- VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((VariableDeclarationStatement) node).fragments().toArray(new VariableDeclarationFragment[4]);
- assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$
- checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$
- checkSourceRange(fragments[1], "z[] = null", source);//$NON-NLS-1$
- checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$
- checkSourceRange(fragments[3], "j[][]", source);//$NON-NLS-1$
- }
-
- /**
- * ForStatement
- */
- public void test0126() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0126", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$
- variableDeclarationFragment.setExtraDimensions(1);
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setType(this.ast.newArrayType(this.ast.newSimpleType(this.ast.newSimpleName("String")), 1));//$NON-NLS-1$
- forStatement.initializers().add(variableDeclarationExpression);
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT);
- forStatement.updaters().add(prefixExpression);
- forStatement.setBody(this.ast.newBlock());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (String[] tab[] = null;; ++i) {}", source); //$NON-NLS-1$
- checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "++i", source); //$NON-NLS-1$
- checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "String[] tab[] = null", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement
- */
- public void test0127() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0127", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$
- variableDeclarationFragment.setExtraDimensions(1);
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
- forStatement.initializers().add(variableDeclarationExpression);
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT);
- forStatement.updaters().add(prefixExpression);
- forStatement.setBody(this.ast.newBlock());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (String tab[] = null;; ++i) {}", source); //$NON-NLS-1$
- checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "++i", source); //$NON-NLS-1$
- checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "String tab[] = null", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement
- */
- public void test0128() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0128", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$
- variableDeclarationFragment.setExtraDimensions(1);
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
- forStatement.initializers().add(variableDeclarationExpression);
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- forStatement.setBody(this.ast.newBlock());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (String tab[] = null;; i++/**/) {}", source); //$NON-NLS-1$
- checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "i++", source); //$NON-NLS-1$
- checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "String tab[] = null", source); //$NON-NLS-1$
- }
-
- /**
- * FieldDeclaration
- */
- public void test0129() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0129", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- VariableDeclarationFragment frag = (VariableDeclarationFragment) ((FieldDeclaration) node).fragments().get(0);
- assertTrue("Not a declaration", frag.getName().isDeclaration()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- fragment.setExtraDimensions(0);
- FieldDeclaration fieldDeclaration = this.ast.newFieldDeclaration(fragment);
- fieldDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- assertTrue("Both AST trees should be identical", fieldDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "int i;", source); //$NON-NLS-1$
- }
-
- /**
- * FieldDeclaration
- */
- public void test0130() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0130", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("x")); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("10"); //$NON-NLS-1$
- fragment.setInitializer(literal);
- fragment.setExtraDimensions(0);
- FieldDeclaration fieldDeclaration = this.ast.newFieldDeclaration(fragment);
- fieldDeclaration.modifiers().add(this.ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
- fieldDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("y"));//$NON-NLS-1$
- fragment.setExtraDimensions(1);
- fragment.setInitializer(this.ast.newNullLiteral());
- fieldDeclaration.fragments().add(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$
- fragment.setExtraDimensions(0);
- fieldDeclaration.fragments().add(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$
- fragment.setExtraDimensions(2);
- fieldDeclaration.fragments().add(fragment);
- assertTrue("Both AST trees should be identical", fieldDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "public int x= 10, y[] = null, i, j[][];", source); //$NON-NLS-1$
- VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((FieldDeclaration) node).fragments().toArray(new VariableDeclarationFragment[4]);
- assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$
- checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$
- checkSourceRange(fragments[1], "y[] = null", source);//$NON-NLS-1$
- checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$
- checkSourceRange(fragments[3], "j[][]", source);//$NON-NLS-1$
- }
-
- /**
- * Argument with final modifier
- */
- public void test0131() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0131", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- assertTrue("Not a declaration", ((FunctionDeclaration) node).getName().isDeclaration()); //$NON-NLS-1$
- List parameters = ((FunctionDeclaration) node).parameters();
- assertTrue("Parameters.length != 1", parameters.size() == 1); //$NON-NLS-1$
- SingleVariableDeclaration arg = (SingleVariableDeclaration) ((FunctionDeclaration) node).parameters().get(0);
- SingleVariableDeclaration singleVariableDeclaration = this.ast.newSingleVariableDeclaration();
- singleVariableDeclaration.modifiers().add(this.ast.newModifier(Modifier.ModifierKeyword.FINAL_KEYWORD));
- singleVariableDeclaration.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- singleVariableDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- assertTrue("Both AST trees should be identical", singleVariableDeclaration.subtreeMatch(new ASTMatcher(), arg)); //$NON-NLS-1$
- checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$
- checkSourceRange(arg, "final int i", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FunctionDeclaration
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0132() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0132", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc();
- checkSourceRange(node, "/** JavaDoc Comment*/\n void foo(final int i) {}", source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FunctionDeclaration
- */
- public void test0133() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0133", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FunctionDeclaration
- */
- public void test0134() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0134", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FieldDeclaration
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0135() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0135", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((FieldDeclaration) node).getJavadoc();
- checkSourceRange(node, "/** JavaDoc Comment*/\n int i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FieldDeclaration
- */
- public void test0136() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0136", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FieldDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "int i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FieldDeclaration
- */
- public void test0137() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0137", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FieldDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "int i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for TypeDeclaration
- */
- public void test0138() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0138", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- String expectedContents = "public class Test {\n" +//$NON-NLS-1$
- " int i;\n" +//$NON-NLS-1$
- "}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for TypeDeclaration
- */
- public void test0139() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0139", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- String expectedContents = "public class Test {\n" +//$NON-NLS-1$
- " int i;\n" +//$NON-NLS-1$
- "}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for TypeDeclaration
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0140() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0140", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- "public class Test {\n" +//$NON-NLS-1$
- " int i;\n" +//$NON-NLS-1$
- "}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0141() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0141", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- " class B {}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- */
- public void test0142() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0142", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "class B {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- */
- public void test0143() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0143", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- */
- public void test0144() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0144", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$
- }
-
- /**
- * Checking initializers
- */
- public void test0145() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0145", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- checkSourceRange(node, "{}", source); //$NON-NLS-1$
- }
-
- /**
- * Checking initializers
- */
- public void test0146() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0146", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- checkSourceRange(node, "static {}", source); //$NON-NLS-1$
- }
-
- /**
- * Checking initializers
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0147() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0147", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- JSdoc actualJavadoc = ((Initializer) node).getJavadoc();
- assertNotNull("Javadoc comment should no be null", actualJavadoc); //$NON-NLS-1$
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- " static {}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-
- }
-
- /**
- * Checking initializers
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0148() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0148", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- JSdoc actualJavadoc = ((Initializer) node).getJavadoc();
- assertNotNull("Javadoc comment should not be null", actualJavadoc); //$NON-NLS-1$
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- " {}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-
- }
-
- /**
- * Checking initializers
- */
- public void test0149() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0149", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- JSdoc actualJavadoc = ((Initializer) node).getJavadoc();
- assertNull("Javadoc comment should be null", actualJavadoc); //$NON-NLS-1$
- checkSourceRange(node, "{}", source); //$NON-NLS-1$
- }
-
- /**
- * Checking syntax error
- */
- public void test0150() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0150", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertTrue("The compilation unit is malformed", !isMalformed(unit)); //$NON-NLS-1$
- assertTrue("The package declaration is not malformed", isMalformed(unit.getPackage())); //$NON-NLS-1$
- List imports = unit.imports();
- assertTrue("The imports list size is not one", imports.size() == 1); //$NON-NLS-1$
- assertTrue("The first import is malformed", !isMalformed((ASTNode) imports.get(0))); //$NON-NLS-1$
- }
-
- /**
- * Checking syntax error
- */
- public void test0151() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0151", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$
- }
-
- /**
- * Checking syntax error
- */
- public void test0152() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0152", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The type is malformed", !isMalformed(node)); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The field is not malformed", isMalformed(node)); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The method is not malformed", isMalformed(node)); //$NON-NLS-1$
- }
-
- /**
- * Checking syntax error
- */
- public void test0153() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0153", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The method is not original", isOriginal(node)); //$NON-NLS-1$
- assertTrue("The method is not malformed", isMalformed(node)); //$NON-NLS-1$
- }
-
- /**
- * Checking binding of package declaration
- */
- public void test0154() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0154", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- IBinding binding = compilationUnit.getPackage().getName().resolveBinding();
- assertNotNull("The package binding is null", binding); //$NON-NLS-1$
- assertTrue("The binding is not a package binding", binding instanceof IPackageBinding); //$NON-NLS-1$
- IPackageBinding packageBinding = (IPackageBinding) binding;
- assertEquals("The package name is incorrect", "test0154", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = compilationUnit.getPackage().getName().resolveBinding();
- assertTrue("The package binding is not canonical", binding == binding2); //$NON-NLS-1$
- }
-
- /**
- * Checking arguments positions
- */
- public void test0155() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0155", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("The result is not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDecl = (FunctionDeclaration) node;
- List parameters = methodDecl.parameters();
- assertTrue("The parameters size is different from 2", parameters.size() == 2); //$NON-NLS-1$
- Object parameter = parameters.get(0);
- assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$
- checkSourceRange((ASTNode) parameter, "int i", source); //$NON-NLS-1$
- parameter = parameters.get(1);
- assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$
- checkSourceRange((ASTNode) parameter, "final boolean b", source); //$NON-NLS-1$
- }
-
- /**
- * Checking arguments positions
- */
- public void test0156() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0156", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("The result is not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDecl = (FunctionDeclaration) node;
- List parameters = methodDecl.parameters();
- assertTrue("The parameters size is different from 1", parameters.size() == 1); //$NON-NLS-1$
- Object parameter = parameters.get(0);
- assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$
- checkSourceRange((ASTNode) parameter, "int i", source); //$NON-NLS-1$
- Block block = methodDecl.getBody();
- List statements = block.statements();
- assertTrue("The statements size is different from 2", statements.size() == 2); //$NON-NLS-1$
- ASTNode statement = (ASTNode) statements.get(0);
- assertTrue("The statements[0] is a postfixExpression statement", statement instanceof ExpressionStatement); //$NON-NLS-1$
- }
-
- /**
- * Check canonic binding for fields
- */
- public void test0157() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test0157.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$
- assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("This is not a field", bodyDeclaration instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) bodyDeclaration;
- List variableFragments = fieldDeclaration.fragments();
- assertTrue("The fragment list is empty", variableFragments.size() != 0); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("the field binding is null", variableBinding); //$NON-NLS-1$
- assertFalse("Not a parameter", variableBinding.isParameter());
- assertTrue("The field binding is not canonical", variableBinding == fragment.resolveBinding()); //$NON-NLS-1$
- typeBinding = variableBinding.getType();
- assertTrue("The type is not an array type", typeBinding.isArray()); //$NON-NLS-1$
- assertTrue("The type binding for the field is not canonical", typeBinding == variableBinding.getType()); //$NON-NLS-1$
- SimpleName name = fragment.getName();
- assertTrue("is a declaration", name.isDeclaration()); //$NON-NLS-1$
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong type", IBinding.VARIABLE, binding.getKind()); //$NON-NLS-1$
- assertTrue("not a field", ((IVariableBinding) binding).isField()); //$NON-NLS-1$
- }
-
- /**
- * Check canonic bindings for fields
- */
- public void test0158() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test0158.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$
- assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$
- SimpleName simpleName = typeDeclaration.getName();
- assertTrue("is a declaration", simpleName.isDeclaration()); //$NON-NLS-1$
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertEquals("wrong name", simpleName.getIdentifier(), binding.getName()); //$NON-NLS-1$
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("This is not a field", bodyDeclaration instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) bodyDeclaration;
- List variableFragments = fieldDeclaration.fragments();
- assertTrue("The fragment list is empty", variableFragments.size() != 0); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("the field binding is null", variableBinding); //$NON-NLS-1$
- assertTrue("The field binding is not canonical", variableBinding == fragment.resolveBinding()); //$NON-NLS-1$
- ITypeBinding typeBinding2 = variableBinding.getType();
- assertTrue("The type is not an array type", typeBinding2.isArray()); //$NON-NLS-1$
- assertTrue("The type binding for the field is not canonical", typeBinding2 == variableBinding.getType()); //$NON-NLS-1$
- assertTrue("The type binding for the field is not canonical with the declaration type binding", typeBinding == typeBinding2.getElementType()); //$NON-NLS-1$
- }
-
- /**
- * Define an anonymous type
- */
- public void test0159() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0159", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- }
-
- /**
- * Check bindings for multiple field declarations
- */
- public void test0160() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0160", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$
- assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("This is not a field", bodyDeclaration instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) bodyDeclaration;
- List variableFragments = fieldDeclaration.fragments();
- assertTrue("The fragment list size is not 2", variableFragments.size() == 2); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0);
- IVariableBinding variableBinding1 = fragment.resolveBinding();
- assertNotNull("the field binding is null", variableBinding1); //$NON-NLS-1$
- assertTrue("The field binding is not canonical", variableBinding1 == fragment.resolveBinding()); //$NON-NLS-1$
- ITypeBinding type1 = variableBinding1.getType();
- assertNotNull("The type is null", type1); //$NON-NLS-1$
- assertTrue("The field type is canonical", type1 == variableBinding1.getType()); //$NON-NLS-1$
- assertTrue("The type is not an array type",type1.isArray()); //$NON-NLS-1$
- assertTrue("The type dimension is 1", type1.getDimensions() == 1); //$NON-NLS-1$
- fragment = (VariableDeclarationFragment) variableFragments.get(1);
- IVariableBinding variableBinding2 = fragment.resolveBinding();
- assertNotNull("the field binding is null", variableBinding2); //$NON-NLS-1$
- assertTrue("The field binding is not canonical", variableBinding2 == fragment.resolveBinding()); //$NON-NLS-1$
- ITypeBinding type2 = variableBinding2.getType();
- type2 = variableBinding2.getType();
- assertNotNull("The type is null", type2); //$NON-NLS-1$
- assertTrue("The field type is canonical", type2 == variableBinding2.getType()); //$NON-NLS-1$
- assertTrue("The type is not an array type",type2.isArray()); //$NON-NLS-1$
- assertTrue("The type dimension is 2", type2.getDimensions() == 2); //$NON-NLS-1$
- assertTrue("Element type is canonical", type1.getElementType() == type2.getElementType()); //$NON-NLS-1$
- assertTrue("type1.id < type2.id", variableBinding1.getVariableId() < variableBinding2.getVariableId()); //$NON-NLS-1$
-
- }
-
- /**
- * Check ITypeBinding APIs:
- * - getModifiers()
- * - getElementType() when it is not an array type
- * - getDimensions() when it is not an array type
- * - getDeclaringClass()
- * - getDeclaringName()
- * - getName()
- * - isNested()
- * - isAnonymous()
- * - isLocal()
- * - isMember()
- * - isArray()
- * - getDeclaredMethods() => returns binding for default constructor
- * - isPrimitive()
- * - isTopLevel()
- * - getSuperclass()
- */
- public void test0161() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0161", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("The type binding should not be null", typeBinding); //$NON-NLS-1$
- assertEquals("The modifier is PUBLIC", Modifier.PUBLIC, typeBinding.getModifiers()); //$NON-NLS-1$
- assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
- assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
- assertNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
- IFunctionBinding[] methods = typeBinding.getDeclaredMethods();
- assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$
- assertEquals("The name is not Test", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$
- assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$
- assertTrue("A nested class", !typeBinding.isNested()); //$NON-NLS-1$
- assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$
- assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
- assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
- assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
- assertTrue("Is nested", typeBinding.isTopLevel()); //$NON-NLS-1$
- assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
- ITypeBinding superclass = typeBinding.getSuperclass();
- assertNotNull("No superclass", superclass); //$NON-NLS-1$
- assertTrue("From source", !superclass.isFromSource()); //$NON-NLS-1$
- ITypeBinding supersuperclass = superclass.getSuperclass();
- assertNull("No superclass for java.lang.Object", supersuperclass); //$NON-NLS-1$
- assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
- }
-
- /**
- * Check ITypeBinding APIs:
- * - getModifiers()
- * - getElementType() when it is not an array type
- * - getDimensions() when it is not an array type
- * - getDeclaringClass()
- * - getDeclaringName()
- * - getName()
- * - isNested()
- * - isAnonymous()
- * - isLocal()
- * - isMember()
- * - isArray()
- * - getDeclaredMethods() => returns binding for default constructor
- * - isPrimitive()
- * - isTopLevel()
- * - getSuperclass()
- */
- public void test0162() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0162", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("The type binding should not be null", typeBinding); //$NON-NLS-1$
- assertEquals("The modifier is PUBLIC", Modifier.PUBLIC, typeBinding.getModifiers()); //$NON-NLS-1$
- assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
- assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
- assertNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
- IFunctionBinding[] methods = typeBinding.getDeclaredMethods();
- assertEquals("Contains no methos", 0, methods.length); //$NON-NLS-1$
- assertEquals("The name is not Test", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$
- assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$
- assertTrue("A nested class", !typeBinding.isNested()); //$NON-NLS-1$
- assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$
- assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
- assertTrue("A class", !typeBinding.isClass()); //$NON-NLS-1$
- assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
- assertTrue("Is nested", typeBinding.isTopLevel()); //$NON-NLS-1$
- assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
- ITypeBinding superclass = typeBinding.getSuperclass();
- assertNull("No superclass", superclass); //$NON-NLS-1$
- assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
- }
-
- /**
- * Test binding for anonymous declaration: new java.lang.Object() {}
- */
- public void test0163() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0163", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- assertTrue("Not an anonymous type declaration", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation anonymousClass = (ClassInstanceCreation) expression;
- ITypeBinding typeBinding = anonymousClass.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not an anonymous class", typeBinding.isAnonymous()); //$NON-NLS-1$
- assertEquals("The modifier is not default", Modifier.NONE, typeBinding.getModifiers()); //$NON-NLS-1$
- assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
- assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
- assertNotNull("This is a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
- assertEquals("The name is not empty", "", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IFunctionBinding[] methods = typeBinding.getDeclaredMethods();
- assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$
- assertTrue("Not a local class", typeBinding.isLocal()); //$NON-NLS-1$
- assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$
- assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$
- assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
- assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
- assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
- assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$
- assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
- assertEquals("wrong qualified name", "", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding superclass = typeBinding.getSuperclass();
- assertNotNull("No superclass", superclass); //$NON-NLS-1$
- assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
- }
-
- /**
- * Test binding for member type declaration
- */
- public void test0164() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0164", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Not an type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$
- assertEquals("The modifier is not default", Modifier.PRIVATE, typeBinding.getModifiers()); //$NON-NLS-1$
- assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
- assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
- assertNotNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
- assertEquals("The name is not 'B'", "B", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IFunctionBinding[] methods = typeBinding.getDeclaredMethods();
- assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$
- assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$
- assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$
- assertTrue("Not a member class", typeBinding.isMember()); //$NON-NLS-1$
- assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
- assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
- assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
- assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$
- assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
- ITypeBinding superclass = typeBinding.getSuperclass();
- assertNotNull("No superclass", superclass); //$NON-NLS-1$
- assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
- }
-
- /**
- * Test binding for local type declaration
- */
- public void test0165() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0165", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Not an type declaration", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
- TypeDeclarationStatement statement = (TypeDeclarationStatement) node;
- AbstractTypeDeclaration typeDeclaration = statement.getDeclaration();
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$
- assertEquals("The modifier is not default", Modifier.NONE, typeBinding.getModifiers()); //$NON-NLS-1$
- assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
- assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
- assertNotNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
- assertEquals("The name is not 'C'", "C", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IFunctionBinding[] methods = typeBinding.getDeclaredMethods();
- assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$
- assertTrue("Not a local class", typeBinding.isLocal()); //$NON-NLS-1$
- assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$
- assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$
- assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
- assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
- assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
- assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$
- assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
- assertEquals("wrong qualified name", "", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding superclass = typeBinding.getSuperclass();
- assertNotNull("No superclass", superclass); //$NON-NLS-1$
- assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
- }
-
- /**
- * Multiple local declaration => VariabledeclarationStatement
- */
- public void test0166() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0166", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("Fragment list is not 4 ", fragments.size() == 4); //$NON-NLS-1$
- VariableDeclarationFragment fragment1 = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding binding1 = fragment1.resolveBinding();
- assertNotNull("Binding is null", binding1); //$NON-NLS-1$
- assertEquals("wrong name for binding1", "x", binding1.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong modifier for binding1", 0, binding1.getModifiers()); //$NON-NLS-1$
- assertTrue("a field", !binding1.isField()); //$NON-NLS-1$
- assertNull("declaring class is not null", binding1.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding typeBinding1 = binding1.getType();
- assertNotNull("typeBinding1 is null", typeBinding1); //$NON-NLS-1$
- assertTrue("typeBinding1 is not a primitive type", typeBinding1.isPrimitive()); //$NON-NLS-1$
- assertTrue("typeBinding1 is not canonical", typeBinding1 == binding1.getType()); //$NON-NLS-1$
- VariableDeclarationFragment fragment2 = (VariableDeclarationFragment) fragments.get(1);
- IVariableBinding binding2 = fragment2.resolveBinding();
- assertNotNull("Binding is null", binding2); //$NON-NLS-1$
- assertEquals("wrong name for binding2", "z", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong modifier for binding2", 0, binding2.getModifiers()); //$NON-NLS-1$
- assertTrue("a field", !binding2.isField()); //$NON-NLS-1$
- assertNull("declaring class is not null", binding2.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding typeBinding2 = binding2.getType();
- assertNotNull("typeBinding2 is null", typeBinding2); //$NON-NLS-1$
- assertTrue("typeBinding2 is not an array type", typeBinding2.isArray()); //$NON-NLS-1$
- assertTrue("typeBinding2 is not canonical", typeBinding2 == binding2.getType()); //$NON-NLS-1$
- assertTrue("primitive type is not canonical", typeBinding1 == typeBinding2.getElementType()); //$NON-NLS-1$
- assertEquals("dimension is 1", 1, typeBinding2.getDimensions()); //$NON-NLS-1$
- assertEquals("it is not int[]", "int[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- VariableDeclarationFragment fragment3 = (VariableDeclarationFragment) fragments.get(2);
- IVariableBinding binding3 = fragment3.resolveBinding();
- assertNotNull("Binding is null", binding3); //$NON-NLS-1$
- assertEquals("wrong name for binding3", "i", binding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong modifier for binding3", 0, binding3.getModifiers()); //$NON-NLS-1$
- assertTrue("a field", !binding3.isField()); //$NON-NLS-1$
- assertNull("declaring class is not null", binding3.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding typeBinding3 = binding3.getType();
- assertNotNull("typeBinding3 is null", typeBinding3); //$NON-NLS-1$
- assertTrue("typeBinding3 is not an primitive type", typeBinding3.isPrimitive()); //$NON-NLS-1$
- assertTrue("typeBinding3 is not canonical", typeBinding3 == binding3.getType()); //$NON-NLS-1$
- assertTrue("primitive type is not canonical", typeBinding1 == typeBinding3); //$NON-NLS-1$
- assertEquals("dimension is 0", 0, typeBinding3.getDimensions()); //$NON-NLS-1$
- assertEquals("it is not the primitive type int", "int", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- VariableDeclarationFragment fragment4 = (VariableDeclarationFragment) fragments.get(3);
- IVariableBinding binding4 = fragment4.resolveBinding();
- assertNotNull("Binding is null", binding4); //$NON-NLS-1$
- assertEquals("wrong name for binding4", "j", binding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong modifier for binding4", 0, binding4.getModifiers()); //$NON-NLS-1$
- assertTrue("a field", !binding4.isField()); //$NON-NLS-1$
- assertNull("declaring class is not null", binding4.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding typeBinding4 = binding4.getType();
- assertNotNull("typeBinding4 is null", typeBinding4); //$NON-NLS-1$
- assertTrue("typeBinding4 is not an array type", typeBinding4.isArray()); //$NON-NLS-1$
- assertTrue("typeBinding4 is not canonical", typeBinding4 == binding4.getType()); //$NON-NLS-1$
- assertTrue("primitive type is not canonical", typeBinding1 == typeBinding4.getElementType()); //$NON-NLS-1$
- assertEquals("dimension is 2", 2, typeBinding4.getDimensions()); //$NON-NLS-1$
- assertEquals("it is not int[][]", "int[][]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("ids in the wrong order", binding1.getVariableId() < binding2.getVariableId()); //$NON-NLS-1$
- assertTrue("ids in the wrong order", binding2.getVariableId() < binding3.getVariableId()); //$NON-NLS-1$
- assertTrue("ids in the wrong order", binding3.getVariableId() < binding4.getVariableId()); //$NON-NLS-1$
- }
-
- /**
- * Check source position for new Test[1+2].length.
- */
- public void test0167() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0167", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Instance of VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("fragment list size is not 1", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertNotNull("No initialization", initialization); //$NON-NLS-1$
- assertTrue("Not a FieldAccess", initialization instanceof FieldAccess); //$NON-NLS-1$
- checkSourceRange(initialization, "new Test[1+2].length", source); //$NON-NLS-1$
- }
-
- /**
- * Check package binding: test0168.test
- */
- public void test0168() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0168.test1", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
- IPackageBinding packageBinding = typeBinding.getPackage();
- assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
- assertEquals("wrong name", "test0168.test1", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- String[] components = packageBinding.getNameComponents();
- assertNotNull("no components", components); //$NON-NLS-1$
- assertTrue("components size != 2", components.length == 2); //$NON-NLS-1$
- assertEquals("wrong component name", "test0168", components[0]); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong component name", "test1", components[1]); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$
- assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$
- assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$
- }
-
- /**
- * Check package binding: test0169
- */
- public void test0169() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0169", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
- IPackageBinding packageBinding = typeBinding.getPackage();
- assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
- assertEquals("wrong name", "test0169", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- String[] components = packageBinding.getNameComponents();
- assertNotNull("no components", components); //$NON-NLS-1$
- assertTrue("components size != 1", components.length == 1); //$NON-NLS-1$
- assertEquals("wrong component name", "test0169", components[0]); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$
- assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$
- assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$
- }
-
- /**
- * Check package binding: test0170
- */
- public void test0170() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test0170.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
- IPackageBinding packageBinding = typeBinding.getPackage();
- assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
- assertEquals("wrong name", "", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- String[] components = packageBinding.getNameComponents();
- assertNotNull("no components", components); //$NON-NLS-1$
- assertTrue("components size != 0", components.length == 0); //$NON-NLS-1$
- assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$
- assertTrue("Not an unnamed package", packageBinding.isUnnamed()); //$NON-NLS-1$
- assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$
- }
-
- /**
- * Check package binding: test0171
- */
- public void test0171() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0171", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() == 2); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
- IPackageBinding packageBinding = typeBinding.getPackage();
- assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
- assertEquals("wrong name", "test0171", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- String[] components = packageBinding.getNameComponents();
- assertNotNull("no components", components); //$NON-NLS-1$
- assertTrue("components size != 1", components.length == 1); //$NON-NLS-1$
- assertEquals("wrong component name", "test0171", components[0]); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$
- assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$
- assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$
-
- typeDeclaration = (TypeDeclaration) types.get(1);
- typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
- IPackageBinding packageBinding2 = typeBinding.getPackage();
- assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
- assertTrue("Package binding is not canonical", packageBinding == packageBinding2); //$NON-NLS-1$
- }
-
- /**
- * Check method binding
- */
- public void test0172() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0172", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- List types = compilationUnit.types();
- assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
- IFunctionBinding[] methods = typeBinding.getDeclaredMethods();
- assertEquals("methods.length != 4", 4, methods.length); //$NON-NLS-1$
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("body declaration size != 3", 3, bodyDeclarations.size()); //$NON-NLS-1$
- FunctionDeclaration method1 = (FunctionDeclaration) bodyDeclarations.get(0);
- IFunctionBinding methodBinding1 = method1.resolveBinding();
- assertNotNull("No method binding for foo", methodBinding1); //$NON-NLS-1$
- SimpleName simpleName = method1.getName();
- assertTrue("not a declaration", simpleName.isDeclaration()); //$NON-NLS-1$
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong name", binding.getName(), simpleName.getIdentifier()); //$NON-NLS-1$
- // search method foo
- IFunctionBinding methodBinding = null;
- loop: for (int i = 0, max = methods.length; i < max; i++) {
- IFunctionBinding currentMethod = methods[i];
- if ("foo".equals(currentMethod.getName())) {
- methodBinding = currentMethod;
- break loop;
- }
- }
- assertNotNull("Cannot be null", methodBinding);
- assertTrue("Canonical method binding", methodBinding1 == methodBinding); //$NON-NLS-1$
- assertTrue("declaring class is canonical", typeBinding == methodBinding1.getDeclaringClass()); //$NON-NLS-1$
- assertEquals("wrong modifier", Modifier.NONE, methodBinding1.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name for method", "foo", methodBinding1.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding[] parameters = methodBinding1.getParameterTypes();
- assertNotNull("No parameters", parameters); //$NON-NLS-1$
- assertEquals("wrong size", 1, parameters.length); //$NON-NLS-1$
- assertEquals("wrong type", "int[]", parameters[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong return type", "void", methodBinding1.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("A constructor", !methodBinding1.isConstructor()); //$NON-NLS-1$
-
- FunctionDeclaration method2 = (FunctionDeclaration) bodyDeclarations.get(1);
- IFunctionBinding methodBinding2 = method2.resolveBinding();
- assertNotNull("No method binding for main", methodBinding2); //$NON-NLS-1$
- // search main
- methodBinding = null;
- loop: for (int i = 0, max = methods.length; i < max; i++) {
- IFunctionBinding currentMethod = methods[i];
- if ("main".equals(currentMethod.getName())) {
- methodBinding = currentMethod;
- break loop;
- }
- }
- assertNotNull("Cannot be null", methodBinding);
- assertTrue("Canonical method binding", methodBinding2 == methodBinding); //$NON-NLS-1$
- assertTrue("declaring class is canonical", typeBinding == methodBinding2.getDeclaringClass()); //$NON-NLS-1$
- assertEquals("wrong modifier", Modifier.PUBLIC | Modifier.STATIC, methodBinding2.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name for method", "main", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding[] parameters2 = methodBinding2.getParameterTypes();
- assertNotNull("No parameters", parameters2); //$NON-NLS-1$
- assertEquals("wrong size", 1, parameters2.length); //$NON-NLS-1$
- assertEquals("wrong type for parameter2[0]", "String[]", parameters2[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong return type", "void", methodBinding2.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("A constructor", !methodBinding2.isConstructor()); //$NON-NLS-1$
-
- FunctionDeclaration method3 = (FunctionDeclaration) bodyDeclarations.get(2);
- IFunctionBinding methodBinding3 = method3.resolveBinding();
- assertNotNull("No method binding for bar", methodBinding3); //$NON-NLS-1$
- // search method bar
- methodBinding = null;
- loop: for (int i = 0, max = methods.length; i < max; i++) {
- IFunctionBinding currentMethod = methods[i];
- if ("bar".equals(currentMethod.getName())) {
- methodBinding = currentMethod;
- break loop;
- }
- }
- assertNotNull("Cannot be null", methodBinding);
- assertTrue("Canonical method binding", methodBinding3 == methodBinding); //$NON-NLS-1$
- assertTrue("declaring class is canonical", typeBinding == methodBinding3.getDeclaringClass()); //$NON-NLS-1$
- assertEquals("wrong modifier", Modifier.PRIVATE, methodBinding3.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name for method", "bar", methodBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding[] parameters3 = methodBinding3.getParameterTypes();
- assertNotNull("No parameters", parameters3); //$NON-NLS-1$
- assertEquals("wrong size", 1, parameters3.length); //$NON-NLS-1$
- assertEquals("wrong type", "String", parameters3[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong return type", "String", methodBinding3.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("A constructor", !methodBinding3.isConstructor()); //$NON-NLS-1$
- assertTrue("The binding is not canonical", parameters3[0] == methodBinding3.getReturnType()); //$NON-NLS-1$
- }
-
- /**
- * i++; IVariableBinding
- */
- public void test0173() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0173", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression ex = expressionStatement.getExpression();
- assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$
- PostfixExpression postfixExpression = (PostfixExpression) ex;
- Expression expr = postfixExpression.getOperand();
- assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$
- SimpleName name = (SimpleName) expr;
- assertTrue("a declaration", !name.isDeclaration()); //$NON-NLS-1$
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
-
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertTrue(variableBinding == binding);
- }
-
- /**
- * i++; IVariableBinding (field)
- */
- public void test0174() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0174", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 1, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression ex = expressionStatement.getExpression();
- assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$
- PostfixExpression postfixExpression = (PostfixExpression) ex;
- Expression expr = postfixExpression.getOperand();
- assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$
- SimpleName name = (SimpleName) expr;
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
-
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("FieldDeclaration", node2 instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node2;
- List fragments = fieldDeclaration.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertTrue(variableBinding == binding);
- }
-
- /**
- * int i = 0; Test IntBinding for the field declaration and the 0 literal
- */
- public void test0175() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0175", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node2;
- List fragments = fieldDeclaration.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- ITypeBinding typeBinding = fragment.getInitializer().resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(variableBinding.getType() == typeBinding);
- }
-
- /**
- * ThisReference
- */
- public void test0176() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0176", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0);
- assertTrue("Return statement", node2 instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node2;
- assertTrue("Not a field access", returnStatement.getExpression() instanceof FieldAccess); //$NON-NLS-1$
- FieldAccess fieldAccess = (FieldAccess) returnStatement.getExpression();
- ITypeBinding typeBinding = fieldAccess.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Expression expr = fieldAccess.getExpression();
- assertTrue("Not a this expression", expr instanceof ThisExpression); //$NON-NLS-1$
- ThisExpression thisExpression = (ThisExpression) expr;
- ITypeBinding typeBinding2 = thisExpression.resolveTypeBinding();
- assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("Not Test", "Test", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * i++; IVariableBinding
- */
- public void test0177() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0177", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 1, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression ex = expressionStatement.getExpression();
- assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$
- PostfixExpression postfixExpression = (PostfixExpression) ex;
- Expression expr = postfixExpression.getOperand();
- assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$
- SimpleName name = (SimpleName) expr;
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
-
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertEquals("return type is not int", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(variableBinding == binding);
- }
-
- /**
- * SuperReference
- */
- public void test0178() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0178", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 1, 0, 0);
- assertTrue("Return statement", node2 instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node2;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not a field access", expr instanceof SuperFieldAccess); //$NON-NLS-1$
- SuperFieldAccess fieldAccess = (SuperFieldAccess) expr;
- ITypeBinding typeBinding = fieldAccess.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Allocation expression
- */
- public void test0179() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0179", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- Expression initialization = fragment.getInitializer();
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue(variableBinding.getType() == typeBinding);
- }
-
- /**
- * Allocation expression
- */
- public void test0180() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0180", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- Expression initialization = fragment.getInitializer();
- assertTrue("No an array creation", initialization instanceof ArrayCreation); //$NON-NLS-1$
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$
- assertTrue(variableBinding.getType() == typeBinding);
- }
-
- /**
- * Allocation expression
- */
- public void test0181() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0181", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- Expression initialization = fragment.getInitializer();
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$
- assertTrue(variableBinding.getType() == typeBinding);
- }
-
- /**
- * BinaryExpression
- */
- public void test0182() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0182", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i < 10", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0183() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0183", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i < 10 && i < 20", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0184() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0184", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i < 10 || i < 20", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0185() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0185", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i == 10", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0186() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0186", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "o == o", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0187() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0187", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof WhileStatement); //$NON-NLS-1$
- WhileStatement whileStatement = (WhileStatement) node2;
- Expression expr = whileStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i <= 10", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0188() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0188", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertTrue("DoStatement", node2 instanceof DoStatement); //$NON-NLS-1$
- DoStatement statement = (DoStatement) node2;
- Expression expr = statement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i <= 10", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0189() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0189", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("ForStatement", node2 instanceof ForStatement); //$NON-NLS-1$
- ForStatement statement = (ForStatement) node2;
- Expression expr = statement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i < 10", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0190() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0190", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 2, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement statement = (IfStatement) node2;
- Expression expr = statement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "scanner.x < selection.start && selection.start < scanner.y", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0191() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0191", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression ex = expressionStatement.getExpression();
- assertTrue("Assignment", ex instanceof Assignment); //$NON-NLS-1$
- Assignment statement = (Assignment) ex;
- Expression rightExpr = statement.getRightHandSide();
- assertTrue("Not an infix expression", rightExpr instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) rightExpr;
- Expression expr = infixExpression.getRightOperand();
- assertNotNull("No right hand side expression", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "2 < 20", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0192() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0192", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- Expression initialization = fragment.getInitializer();
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue(variableBinding.getType() == typeBinding);
- checkSourceRange(initialization, "0", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0193() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0193", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- Expression initialization = fragment.getInitializer();
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue(variableBinding.getType() == typeBinding);
- checkSourceRange(initialization, "new Inner()", source); //$NON-NLS-1$
- assertEquals("Wrong type", "Inner", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Initializer
- */
- public void test0194() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0194", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- Expression initialization = fragment.getInitializer();
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue(variableBinding.getType() == typeBinding);
- checkSourceRange(initialization, "new Inner[10]", source); //$NON-NLS-1$
- assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong type", "Inner[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Initializer
- */
- public void test0195() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0195", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 1, 0, 1);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression ex = expressionStatement.getExpression();
- assertTrue("FunctionInvocation", ex instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) ex;
- checkSourceRange(methodInvocation, "a.useFile(/*]*/a.getFile()/*[*/)", source); //$NON-NLS-1$
- List list = methodInvocation.arguments();
- assertTrue("Parameter list not empty", list.size() == 1); //$NON-NLS-1$
- Expression parameter = (Expression) list.get(0);
- assertTrue("Not a method invocation", parameter instanceof FunctionInvocation); //$NON-NLS-1$
- ITypeBinding typeBinding = parameter.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "File", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(parameter, "a.getFile()", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0196() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0196", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 2);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression ex = expressionStatement.getExpression();
- assertTrue("Assignment", ex instanceof Assignment); //$NON-NLS-1$
- Assignment statement = (Assignment) ex;
- Expression rightExpr = statement.getRightHandSide();
- assertTrue("Not an instanceof expression", rightExpr instanceof InstanceofExpression); //$NON-NLS-1$
- ITypeBinding typeBinding = rightExpr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong type", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(rightExpr, "inner instanceof Inner", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0197() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0197", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertProblemsSize(unit, 0);
- ASTNode node2 = getASTNode(unit, 1, 0, 1);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression ex = expressionStatement.getExpression();
- assertTrue("FunctionInvocation", ex instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) ex;
- checkSourceRange(methodInvocation, "a.getFile()/*[*/.getName()", source); //$NON-NLS-1$
- Expression receiver = methodInvocation.getExpression();
- assertTrue("Not a method invocation", receiver instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation2 = (FunctionInvocation) receiver;
- ITypeBinding typeBinding = methodInvocation2.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "File", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(methodInvocation2, "a.getFile()", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0198() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0198", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node2;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not an infixExpression", expr instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expr;
- Expression left = infixExpression.getLeftOperand();
- assertTrue("Not an InfixExpression", left instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression2 = (InfixExpression) left;
- Expression right = infixExpression2.getRightOperand();
- assertTrue("Not an InfixExpression", right instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression3 = (InfixExpression) right;
- assertEquals("A multiplication", InfixExpression.Operator.TIMES, infixExpression3.getOperator()); //$NON-NLS-1$
- ITypeBinding typeBinding = infixExpression3.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(infixExpression3, "20 * 30", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0199() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0199", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertTrue("Not an infixExpression", initialization instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) initialization;
- Expression left = infixExpression.getLeftOperand();
- assertTrue("Not an InfixExpression", left instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression2 = (InfixExpression) left;
- Expression right = infixExpression2.getRightOperand();
- assertTrue("Not an InfixExpression", right instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression3 = (InfixExpression) right;
- assertEquals("A multiplication", InfixExpression.Operator.TIMES, infixExpression3.getOperator()); //$NON-NLS-1$
- ITypeBinding typeBinding = infixExpression3.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(infixExpression3, "10 * 30", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0200() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0200", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 1, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertTrue("Not an infixExpression", initialization instanceof FieldAccess); //$NON-NLS-1$
- FieldAccess fieldAccess = (FieldAccess) initialization;
- Expression receiver = fieldAccess.getExpression();
- assertTrue("ArrayCreation", receiver instanceof ArrayCreation); //$NON-NLS-1$
- ArrayCreation arrayCreation = (ArrayCreation) receiver;
- List dimensions = arrayCreation.dimensions();
- assertEquals("Wrong dimension", 1, dimensions.size()); //$NON-NLS-1$
- Expression dim = (Expression) dimensions.get(0);
- assertTrue("InfixExpression", dim instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) dim;
- ITypeBinding typeBinding = infixExpression.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(infixExpression, "1 + 2", source); //$NON-NLS-1$
- }
-
- /**
- * Position inside for statement: PR 3300
- */
- public void test0201() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0201", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("ForStatement", node2 instanceof ForStatement); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node2;
- List initializers = forStatement.initializers();
- assertTrue("wrong size", initializers.size() == 1); //$NON-NLS-1$
- Expression init = (Expression) initializers.get(0);
- checkSourceRange(init, "int i= 0", source); //$NON-NLS-1$
- }
-
- /**
- * PR 7386
- */
- public void test0202() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0202", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("FieldDeclaration", node2 instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node2;
- checkSourceRange(fieldDeclaration, "int f= (2);", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$
- checkSourceRange(initialization, "(2)", source); //$NON-NLS-1$
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("no binding", typeBinding); //$NON-NLS-1$
- assertEquals("not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * PR 7386
- */
- public void test0203() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0203", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("FieldDeclaration", node2 instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node2;
- checkSourceRange(fieldDeclaration, "int f= (2);", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) initialization;
- checkSourceRange(parenthesizedExpression, "(2)", source); //$NON-NLS-1$
- Expression expr = parenthesizedExpression.getExpression();
- checkSourceRange(expr, "2", source); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("no binding", typeBinding); //$NON-NLS-1$
- assertEquals("not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("type binding is canonical", typeBinding == parenthesizedExpression.resolveTypeBinding()); //$NON-NLS-1$
- }
-
- /**
- * PR 7386
- */
- public void test0204() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0204", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("FieldDeclaration", node2 instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node2;
- checkSourceRange(fieldDeclaration, "int f= ((2));", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) initialization;
- checkSourceRange(parenthesizedExpression, "((2))", source); //$NON-NLS-1$
- Expression expr = parenthesizedExpression.getExpression();
- assertTrue("Not a parenthesized expression", expr instanceof ParenthesizedExpression); //$NON-NLS-1$
- ParenthesizedExpression parenthesizedExpression2 = (ParenthesizedExpression) expr;
- checkSourceRange(parenthesizedExpression2, "(2)", source); //$NON-NLS-1$
- expr = parenthesizedExpression2.getExpression();
- checkSourceRange(expr, "2", source); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("no binding", typeBinding); //$NON-NLS-1$
- assertEquals("not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = parenthesizedExpression.resolveTypeBinding();
- assertNotNull("no binding", typeBinding); //$NON-NLS-1$
- assertEquals("not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("type binding is canonical", typeBinding == parenthesizedExpression2.resolveTypeBinding()); //$NON-NLS-1$
- }
-
-
- /**
- * Local class end position when trailing comment
- */
- public void test0205() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0205", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("TypeDeclarationStatement", node2 instanceof TypeDeclarationStatement); //$NON-NLS-1$
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node2;
- AbstractTypeDeclaration typeDeclaration = typeDeclarationStatement.getDeclaration();
- assertEquals("wrong name", "AA", typeDeclaration.getName().getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(typeDeclaration, "class AA extends Test {}", source); //$NON-NLS-1$
- }
-
- /**
- * QualifiedName
- */
- public void test0206() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0206", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 5, 0);
- assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node2;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not a qualifiedName", expr instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) expr;
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not an int (typeBinding)", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(qualifiedName, "field1.field2.field3.field4.i", source); //$NON-NLS-1$
- assertTrue("Not a simple name", qualifiedName.getName().isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = qualifiedName.getName();
- assertTrue("a declaration", !simpleName.isDeclaration()); //$NON-NLS-1$
- checkSourceRange(simpleName, "i", source); //$NON-NLS-1$
- ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
- assertNotNull("No typebinding2", typeBinding2); //$NON-NLS-1$
- assertEquals("Not an int (typeBinding2)", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Not Test", "Test", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not default", Modifier.PUBLIC, variableBinding.getModifiers()); //$NON-NLS-1$
- Name qualifierName = qualifiedName.getQualifier();
- assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(qualifierName, "field1.field2.field3.field4", source); //$NON-NLS-1$
- ITypeBinding typeBinding5 = qualifierName.resolveTypeBinding();
- assertNotNull("No binding5", typeBinding5); //$NON-NLS-1$
- assertEquals("Not Test", "Test", typeBinding5.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-
- qualifiedName = (QualifiedName) qualifierName;
- simpleName = qualifiedName.getName();
- checkSourceRange(simpleName, "field4", source); //$NON-NLS-1$
- ITypeBinding typeBinding6 = simpleName.resolveTypeBinding();
- assertNotNull("No binding6", typeBinding6); //$NON-NLS-1$
- assertEquals("Not Test", "Test", typeBinding6.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-
- qualifierName = qualifiedName.getQualifier();
- assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(qualifierName, "field1.field2.field3", source); //$NON-NLS-1$
- ITypeBinding typeBinding7 = qualifierName.resolveTypeBinding();
- assertNotNull("No binding7", typeBinding7); //$NON-NLS-1$
- assertEquals("Not Test", "Test", typeBinding7.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-
- qualifiedName = (QualifiedName) qualifierName;
- simpleName = qualifiedName.getName();
- checkSourceRange(simpleName, "field3", source); //$NON-NLS-1$
- qualifierName = qualifiedName.getQualifier();
- assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(qualifierName, "field1.field2", source); //$NON-NLS-1$
- ITypeBinding typeBinding3 = qualifierName.resolveTypeBinding();
- assertNotNull("No binding3", typeBinding3); //$NON-NLS-1$
- assertEquals("Not Test", "Test", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- qualifiedName = (QualifiedName) qualifierName;
- simpleName = qualifiedName.getName();
- checkSourceRange(simpleName, "field2", source); //$NON-NLS-1$
- qualifierName = qualifiedName.getQualifier();
- assertTrue("Not a simple name", qualifierName.isSimpleName()); //$NON-NLS-1$
- assertTrue("a declaration", !((SimpleName)qualifierName).isDeclaration()); //$NON-NLS-1$
- checkSourceRange(qualifierName, "field1", source); //$NON-NLS-1$
- ITypeBinding typeBinding4 = qualifierName.resolveTypeBinding();
- assertNotNull("No binding4", typeBinding4); //$NON-NLS-1$
- assertEquals("Not Test", "Test", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check javadoc for FunctionDeclaration
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0207() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0207", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc();
- checkSourceRange(node, "/** JavaDoc Comment*/\n void foo(final int i) {}", source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FunctionDeclaration
- */
- public void test0208() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0208", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FunctionDeclaration
- */
- public void test0209() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0209", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FieldDeclaration
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0210() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0210", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((FieldDeclaration) node).getJavadoc();
- checkSourceRange(node, "/** JavaDoc Comment*/\n int i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FieldDeclaration
- */
- public void test0211() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0211", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FieldDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "int i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FieldDeclaration
- */
- public void test0212() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0212", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FieldDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "int i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for TypeDeclaration
- */
- public void test0213() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0213", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- String expectedContents = "public class Test {\n" +//$NON-NLS-1$
- " int i;\n" +//$NON-NLS-1$
- "}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for TypeDeclaration
- */
- public void test0214() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0214", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- String expectedContents = "public class Test {\n" +//$NON-NLS-1$
- " int i;\n" +//$NON-NLS-1$
- "}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for TypeDeclaration
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0215() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0215", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- "public class Test {\n" +//$NON-NLS-1$
- " int i;\n" +//$NON-NLS-1$
- "}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0216() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0216", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- " class B {}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- */
- public void test0217() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0217", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "class B {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- */
- public void test0218() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0218", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for MemberTypeDeclaration
- */
- public void test0219() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0219", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$
- }
-
- /**
- * Checking initializers
- */
- public void test0220() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0220", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- checkSourceRange(node, "{}", source); //$NON-NLS-1$
- }
-
- /**
- * Checking initializers
- */
- public void test0221() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0221", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- checkSourceRange(node, "static {}", source); //$NON-NLS-1$
- }
-
- /**
- * Checking initializers
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0222() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0222", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- JSdoc actualJavadoc = ((Initializer) node).getJavadoc();
- assertNotNull("Javadoc comment should no be null", actualJavadoc); //$NON-NLS-1$
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- " static {}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-
- }
-
- /**
- * Checking initializers
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0223() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0223", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- JSdoc actualJavadoc = ((Initializer) node).getJavadoc();
- assertNotNull("Javadoc comment should not be null", actualJavadoc); //$NON-NLS-1$
- String expectedContents =
- "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
- " {}";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-
- }
-
- /**
- * Checking initializers
- */
- public void test0224() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0224", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- JSdoc actualJavadoc = ((Initializer) node).getJavadoc();
- assertNull("Javadoc comment should be null", actualJavadoc); //$NON-NLS-1$
- checkSourceRange(node, "{}", source); //$NON-NLS-1$
- }
-
- /**
- * Continue ==> ContinueStatement
- */
- public void test0225() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0225", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0);
- checkSourceRange(labeledStatement.getLabel(), "label", source); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) labeledStatement.getBody();
- ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- ContinueStatement continueStatement = this.ast.newContinueStatement();
- continueStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "continue label;", source); //$NON-NLS-1$
- checkSourceRange(statement.getLabel(), "label", source); //$NON-NLS-1$
- }
-
- /**
- * Break + label ==> BreakStatement
- */
- public void test0226() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0226", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0);
- checkSourceRange(labeledStatement.getLabel(), "label", source); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) labeledStatement.getBody();
- BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- BreakStatement breakStatement = this.ast.newBreakStatement();
- breakStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "break label;", source); //$NON-NLS-1$
- checkSourceRange(statement.getLabel(), "label", source); //$NON-NLS-1$
- }
-
- /**
- * QualifiedName
- */
- public void test0227() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0227", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 3, 2, 0);
- assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node2;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not a qualifiedName", expr instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) expr;
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not an long (typeBinding)", "long", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(qualifiedName, "field.fB.fA.j", source); //$NON-NLS-1$
-
- SimpleName simpleName = qualifiedName.getName();
- checkSourceRange(simpleName, "j", source); //$NON-NLS-1$
- ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
- assertEquals("Not an long (typeBinding2)", "long", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Not A", "A", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not default", Modifier.NONE, variableBinding.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name", "j", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-
- Name qualifierName = qualifiedName.getQualifier();
- assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(qualifierName, "field.fB.fA", source); //$NON-NLS-1$
- qualifiedName = (QualifiedName) qualifierName;
- ITypeBinding typeBinding3 = qualifiedName.resolveTypeBinding();
- assertNotNull("No type binding3", typeBinding3); //$NON-NLS-1$
- assertEquals("Not an A", "A", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- simpleName = qualifiedName.getName();
- checkSourceRange(simpleName, "fA", source); //$NON-NLS-1$
- ITypeBinding typeBinding4 = simpleName.resolveTypeBinding();
- assertNotNull("No typeBinding4", typeBinding4); //$NON-NLS-1$
- assertEquals("Not an A", "A", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = qualifiedName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertTrue("VariableBinding", binding2 instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding2 = (IVariableBinding) binding2;
- assertEquals("Not B", "B", variableBinding2.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not default", Modifier.NONE, variableBinding2.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name", "fA", variableBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-
- qualifierName = qualifiedName.getQualifier();
- assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(qualifierName, "field.fB", source); //$NON-NLS-1$
- qualifiedName = (QualifiedName) qualifierName;
- ITypeBinding typeBinding5 = qualifiedName.resolveTypeBinding();
- assertNotNull("No typeBinding5", typeBinding5); //$NON-NLS-1$
- assertEquals("Not a B", "B", typeBinding5.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- simpleName = qualifiedName.getName();
- checkSourceRange(simpleName, "fB", source); //$NON-NLS-1$
- ITypeBinding typeBinding6 = simpleName.resolveTypeBinding();
- assertNotNull("No typebinding6", typeBinding6); //$NON-NLS-1$
- assertEquals("not a B", "B", typeBinding6.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding3 = qualifiedName.resolveBinding();
- assertNotNull("No binding2", binding3); //$NON-NLS-1$
- assertTrue("VariableBinding", binding3 instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding3 = (IVariableBinding) binding3;
- assertEquals("Not C", "C", variableBinding3.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not default", Modifier.NONE, variableBinding3.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name", "fB", variableBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-
- qualifierName = qualifiedName.getQualifier();
- assertTrue("Not a simple name", qualifierName.isSimpleName()); //$NON-NLS-1$
- checkSourceRange(qualifierName, "field", source); //$NON-NLS-1$
- simpleName = (SimpleName) qualifierName;
- ITypeBinding typeBinding7 = simpleName.resolveTypeBinding();
- assertNotNull("No typeBinding7", typeBinding7); //$NON-NLS-1$
- assertEquals("Not a C", "C", typeBinding7.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding4 = simpleName.resolveBinding();
- assertNotNull("No binding4", binding4); //$NON-NLS-1$
- assertTrue("VariableBinding", binding4 instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding4 = (IVariableBinding) binding4;
- assertEquals("Not Test", "Test", variableBinding4.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not public", Modifier.PUBLIC, variableBinding4.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name", "field", variableBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong return type", "C", variableBinding4.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * QualifiedName as TypeReference
- */
- public void test0228() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0228", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0);
- assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node2;
- Expression expr = returnStatement.getExpression();
- checkSourceRange(expr, "test0228.Test.foo()", source); //$NON-NLS-1$
- assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expr;
- Expression qualifier = methodInvocation.getExpression();
- assertNotNull("no qualifier", qualifier); //$NON-NLS-1$
- assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) qualifier;
- checkSourceRange(qualifiedName, "test0228.Test", source); //$NON-NLS-1$
- ITypeBinding typeBinding = qualifiedName.resolveTypeBinding();
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong type", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = qualifiedName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Not a type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
-
- }
-
- /**
- * FunctionInvocation
- */
- public void test0229() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0229", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression expr = expressionStatement.getExpression();
- assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$
- checkSourceRange(expr, "System.err.println()", source); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expr;
- Expression qualifier = methodInvocation.getExpression();
- assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) qualifier;
- ITypeBinding typeBinding = qualifier.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = qualifiedName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("wrong name", "err", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName methodName = methodInvocation.getName();
- IBinding binding2 = methodName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- }
-
- /**
- * FunctionInvocation
- */
- public void test0230() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0230", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression expr = expressionStatement.getExpression();
- assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$
- checkSourceRange(expr, "err.println()", source); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expr;
- Expression qualifier = methodInvocation.getExpression();
- assertTrue("SimpleName", qualifier instanceof SimpleName); //$NON-NLS-1$
- SimpleName name = (SimpleName) qualifier;
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong name", "err", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding = name.resolveTypeBinding();
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wron type name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * FunctionInvocation
- */
- public void test0231() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0231", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression expr = expressionStatement.getExpression();
- assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$
- checkSourceRange(expr, "System.err.println()", source); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expr;
- Expression qualifier = methodInvocation.getExpression();
- assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) qualifier;
- ITypeBinding typeBinding = qualifier.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = qualifiedName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("wrong name", "err", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName methodName = methodInvocation.getName();
- IBinding binding2 = methodName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- Name name = qualifiedName.getQualifier();
- assertTrue("SimpleName", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
- assertNotNull("No typeBinding2", typeBinding2); //$NON-NLS-1$
- assertEquals("wrong type name", "System", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * FunctionInvocation
- */
- public void test0232() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0232", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = variableDeclarationFragment.getInitializer();
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$
- assertEquals("wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("QualifiedName", initialization instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) initialization;
- SimpleName simpleName = qualifiedName.getName();
- ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- assertTrue("Not a primitive type", typeBinding2.isPrimitive()); //$NON-NLS-1$
- assertEquals("wrong name", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("IVariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertNull("No declaring class", variableBinding.getDeclaringClass()); //$NON-NLS-1$
- }
-
- /**
- * Checking that only syntax errors are reported for the MALFORMED tag
- */
- public void test0233() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0233", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$
- assertEquals("No problem found", 1, unit.getMessages().length); //$NON-NLS-1$
- assertEquals("No problem found", 1, unit.getProblems().length); //$NON-NLS-1$
- }
-
- /**
- * Checking that null is returned for a resolveBinding if the type is unknown
- */
- public void test0234() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0234", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("No problem found", 1, unit.getMessages().length); //$NON-NLS-1$
- assertEquals("No problem found", 1, unit.getProblems().length); //$NON-NLS-1$
- assertTrue("FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNull("binding not null", variableBinding); //$NON-NLS-1$
- }
-
- /**
- * Checking that null is returned for a resolveBinding if the type is unknown
- */
- public void test0235() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0235", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("problems found", 0, unit.getMessages().length); //$NON-NLS-1$
- assertEquals("problems found", 0, unit.getProblems().length); //$NON-NLS-1$
- assertTrue("FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=9452
- */
- public void test0237() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "junit.framework", "TestCase.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- }
-
- /**
- * Check ThisExpression
- */
- public void test0238() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0238", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
- AbstractTypeDeclaration typeDecl = typeDeclarationStatement.getDeclaration();
- Object o = typeDecl.bodyDeclarations().get(0);
- assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDecl = (FunctionDeclaration) o;
- Block block = methodDecl.getBody();
- List statements = block.statements();
- assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(0);
- assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) stmt;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not a method invocation", expr instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expr;
- checkSourceRange(methodInvocation, "Test.this.bar()", source); //$NON-NLS-1$
- Expression qualifier = methodInvocation.getExpression();
- assertTrue("Not a ThisExpression", qualifier instanceof ThisExpression); //$NON-NLS-1$
- ThisExpression thisExpression = (ThisExpression) qualifier;
- Name name = thisExpression.getQualifier();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong name", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check ThisExpression
- */
- public void test0239() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0239", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 0);
- assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
- AbstractTypeDeclaration typeDecl = typeDeclarationStatement.getDeclaration();
- Object o = typeDecl.bodyDeclarations().get(0);
- assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDecl = (FunctionDeclaration) o;
- Block block = methodDecl.getBody();
- List statements = block.statements();
- assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(0);
- assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) stmt;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not a SuperMethodInvocation", expr instanceof SuperMethodInvocation); //$NON-NLS-1$
- SuperMethodInvocation superMethodInvocation = (SuperMethodInvocation) expr;
- Name name = superMethodInvocation.getQualifier();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("A type binding", binding instanceof ITypeBinding); //$NON-NLS-1$
- assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Name methodName = superMethodInvocation.getName();
- IBinding binding2 = methodName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertTrue("No an IFunctionBinding", binding2 instanceof IFunctionBinding); //$NON-NLS-1$
- IFunctionBinding methodBinding = (IFunctionBinding) binding2;
- assertEquals("Not bar", "bar", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not T", "T", methodBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check FieldAccess
- */
- public void test0240() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0240", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
- AbstractTypeDeclaration typeDecl = typeDeclarationStatement.getDeclaration();
- Object o = typeDecl.bodyDeclarations().get(0);
- assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDecl = (FunctionDeclaration) o;
- Block block = methodDecl.getBody();
- List statements = block.statements();
- assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(0);
- assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) stmt;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not a field access", expr instanceof FieldAccess); //$NON-NLS-1$
- FieldAccess fieldAccess = (FieldAccess) expr;
- Expression qualifier = fieldAccess.getExpression();
- assertTrue("Not a ThisExpression", qualifier instanceof ThisExpression); //$NON-NLS-1$
- ThisExpression thisExpression = (ThisExpression) qualifier;
- Name name = thisExpression.getQualifier();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Name fieldName = fieldAccess.getName();
- IBinding binding2 = fieldName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertEquals("Wrong name", "f", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong modifier", Modifier.PUBLIC, binding2.getModifiers()); //$NON-NLS-1$
- ITypeBinding typeBinding = fieldName.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check order of body declarations
- */
- public void test0241() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0241", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0);
- assertTrue("Not a type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- assertTrue("Not a declaration", ((TypeDeclaration) node).getName().isDeclaration()); //$NON-NLS-1$
- assertEquals("Wrong size", 11, ((TypeDeclaration)node).bodyDeclarations().size()); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 2);
- assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 3);
- assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 4);
- assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 5);
- assertTrue("Not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 6);
- assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 7);
- assertTrue("Not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 8);
- assertTrue("Not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 9);
- assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 10);
- assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- }
-
- /**
- * Check ThisExpression
- */
- public void test0242() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0242", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 0);
- assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
- AbstractTypeDeclaration typeDecl = typeDeclarationStatement.getDeclaration();
- Object o = typeDecl.bodyDeclarations().get(0);
- assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDecl = (FunctionDeclaration) o;
- Block block = methodDecl.getBody();
- List statements = block.statements();
- assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(0);
- assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) stmt;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not a SuperFieldAccess", expr instanceof SuperFieldAccess); //$NON-NLS-1$
- SuperFieldAccess superFieldAccess = (SuperFieldAccess) expr;
- Name name = superFieldAccess.getQualifier();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("A type binding", binding instanceof ITypeBinding); //$NON-NLS-1$
- assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Name fieldName = superFieldAccess.getName();
- IBinding binding2 = fieldName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertTrue("No an IVariableBinding", binding2 instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding2;
- assertEquals("Not f", "f", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not T", "T", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding2 = fieldName.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check catch clause positions:
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10570
- */
- public void test0243() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0243", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a try statement", node instanceof TryStatement); //$NON-NLS-1$
- TryStatement tryStatement = (TryStatement) node;
- List catchClauses = tryStatement.catchClauses();
- assertEquals("wrong size", 1, catchClauses.size()); //$NON-NLS-1$
- CatchClause catchClause = (CatchClause) catchClauses.get(0);
- checkSourceRange(catchClause, "catch (Exception e){m();}", source); //$NON-NLS-1$
- }
-
- /**
- * Check catch clause positions:
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10570
- */
- public void test0244() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0244", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a try statement", node instanceof TryStatement); //$NON-NLS-1$
- TryStatement tryStatement = (TryStatement) node;
- List catchClauses = tryStatement.catchClauses();
- assertEquals("wrong size", 2, catchClauses.size()); //$NON-NLS-1$
- CatchClause catchClause = (CatchClause) catchClauses.get(0);
- checkSourceRange(catchClause, "catch (RuntimeException e){m();}", source); //$NON-NLS-1$
- catchClause = (CatchClause) catchClauses.get(1);
- checkSourceRange(catchClause, "catch(Exception e) {}", source); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=10587
- */
- public void test0245() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0245", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expr = returnStatement.getExpression();
- assertTrue("not a name", expr instanceof Name); //$NON-NLS-1$
- Name name = (Name) expr;
- IBinding binding = name.resolveBinding();
- assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Not i", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not int", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ASTNode declaringNode = unit.findDeclaringNode(variableBinding);
- assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$
- assertTrue("Not a VariableDeclarationFragment", declaringNode instanceof VariableDeclarationFragment); //$NON-NLS-1$
- }
-
- /**
- * Test binding resolution for import declaration
- */
- public void test0246() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0246", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- List imports = unit.imports();
- assertEquals("wrong imports size", 2, imports.size()); //$NON-NLS-1$
- ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0);
- assertTrue("Not on demand", importDeclaration.isOnDemand()); //$NON-NLS-1$
- checkSourceRange(importDeclaration, "import java.util.*;", source); //$NON-NLS-1$
- IBinding binding = importDeclaration.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$
- assertEquals("Wrong name", "java.util", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- importDeclaration = (ImportDeclaration) imports.get(1);
- assertTrue("On demand", !importDeclaration.isOnDemand()); //$NON-NLS-1$
- checkSourceRange(importDeclaration, "import java.io.IOException;", source); //$NON-NLS-1$
- binding = importDeclaration.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertEquals("Wrong name", "IOException", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Test binding resolution for import declaration
- */
- public void test0247() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0247", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- PackageDeclaration packageDeclaration = unit.getPackage();
- checkSourceRange(packageDeclaration, "package test0247;", source); //$NON-NLS-1$
- IPackageBinding binding = packageDeclaration.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$
- assertEquals("Wrong name", "test0247", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592
- */
- public void test0248() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0248", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 1, parameters.size()); //$NON-NLS-1$
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- Name name = singleVariableDeclaration.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592
- */
- public void test0249() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0249", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 2, 1);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not an assignment", expression instanceof Assignment); //$NON-NLS-1$
- Assignment assignment = (Assignment) expression;
- Expression leftHandSide = assignment.getLeftHandSide();
- assertTrue("Not a qualified name", leftHandSide instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) leftHandSide;
- Name simpleName = qualifiedName.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertTrue("Not a IVariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "k", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong modifier", Modifier.STATIC, variableBinding.getModifiers()); //$NON-NLS-1$
- assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong declaring class name", "j", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592
- */
- public void test0250() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0250", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- Name name = singleVariableDeclaration.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check qualified name resolution for static fields
- */
- public void test0251() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0251", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- checkSourceRange(methodInvocation, "java.lang.System.out.println()", source); //$NON-NLS-1$
- Expression qualifier = methodInvocation.getExpression();
- assertTrue("Not a qualified name", qualifier instanceof QualifiedName); //$NON-NLS-1$
- checkSourceRange(qualifier, "java.lang.System.out", source); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) qualifier;
- Name typeName = qualifiedName.getQualifier();
- assertTrue("Not a QualifiedName", typeName instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedTypeName = (QualifiedName) typeName;
- IBinding binding = qualifiedTypeName.getName().resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong name", "System", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- binding = qualifiedTypeName.getQualifier().resolveBinding();
- assertNotNull("No binding2", binding); //$NON-NLS-1$
- assertEquals("Wrong type binding", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$
- }
-
- /**
- * Check binding for anonymous class
- */
- public void test0252() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0252", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- IFunctionBinding methodBinding = classInstanceCreation.resolveConstructorBinding();
- assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$
- assertTrue("Not a constructor", methodBinding.isConstructor()); //$NON-NLS-1$
- assertTrue("Not an anonymous class", methodBinding.getDeclaringClass().isAnonymous()); //$NON-NLS-1$
- assertEquals("Not an anonymous class of java.lang.Object", "Object", methodBinding.getDeclaringClass().getSuperclass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not an anonymous class of java.lang.Object", "java.lang", methodBinding.getDeclaringClass().getSuperclass().getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check binding for allocation expression
- */
- public void test0253() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0253", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- IFunctionBinding methodBinding = classInstanceCreation.resolveConstructorBinding();
- assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$
- assertTrue("Not a constructor", methodBinding.isConstructor()); //$NON-NLS-1$
- assertEquals("Wrong size", 1, methodBinding.getParameterTypes().length); //$NON-NLS-1$
- assertEquals("Wrong type", "String", methodBinding.getParameterTypes()[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * Check binding for allocation expression
- */
- public void test0254() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0254", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 1, 0);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong type", "C", binding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-
- /**
- * Check binding for allocation expression
- */
- public void test0255() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0255", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- List arguments = methodInvocation.arguments();
- assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
- }
-
- /**
- * Check binding for allocation expression
- */
- public void test0256() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0256", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- List arguments = methodInvocation.arguments();
- assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
- }
-
- /**
- * Check binding for allocation expression
- */
- public void test0257() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0257", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- List arguments = methodInvocation.arguments();
- assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
- }
-
- /**
- * Check binding for allocation expression
- */
- public void test0258() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0258", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- List arguments = methodInvocation.arguments();
- assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10663
- */
- public void test0259() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0259", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592
- */
- public void test0260() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0260", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- IBinding binding = singleVariableDeclaration.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- Name name = singleVariableDeclaration.getName();
- assertTrue("Not a simple name", name instanceof SimpleName); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- assertEquals("Wrong name", "i", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = name.resolveBinding();
- assertNotNull("No binding", binding2); //$NON-NLS-1$
- assertTrue("binding == binding2", binding == binding2); //$NON-NLS-1$
- assertTrue("Not a variable binding", binding2 instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding2;
- assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10679
- */
- public void test0261() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0261", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("Wrong msg size", 1, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertEquals("Wrong pb size", 1, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- ITypeBinding binding = expression.resolveTypeBinding();
- assertNull("got a binding", binding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10676
- */
- public void test0262() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0262", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expr = expressionStatement.getExpression();
- assertTrue("Not a FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expr;
- List arguments = methodInvocation.arguments();
- assertEquals("Wrong argument list size", 1, arguments.size()); //$NON-NLS-1$
- Expression expr2 = (Expression) arguments.get(0);
- assertTrue("Not a class instance creation", expr2 instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expr2;
- arguments = classInstanceCreation.arguments();
- assertEquals("Wrong size", 1, arguments.size()); //$NON-NLS-1$
- Expression expression2 = (Expression) arguments.get(0);
- assertTrue("Not a string literal", expression2 instanceof StringLiteral); //$NON-NLS-1$
- StringLiteral stringLiteral = (StringLiteral) expression2;
- ITypeBinding typeBinding = stringLiteral.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "String", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10700
- */
- public void test0263() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0263", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expr = expressionStatement.getExpression();
- assertTrue("Not a FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expr;
- List arguments = methodInvocation.arguments();
- assertEquals("Wrong argument list size", 1, arguments.size()); //$NON-NLS-1$
- Expression expr2 = (Expression) arguments.get(0);
- assertTrue("Not a simple name", expr2 instanceof SimpleName); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expr2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10699
- */
- public void test0264() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0264", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong fragment size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- assertNotNull("No anonymousclassdeclaration", anonymousClassDeclaration); //$NON-NLS-1$
- String expectedSourceRange =
- "{\n"+ //$NON-NLS-1$
- " void m(int k){\n"+ //$NON-NLS-1$
- " k= i;\n"+ //$NON-NLS-1$
- " }\n"+ //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(anonymousClassDeclaration, expectedSourceRange, source);
- List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 1, bodyDeclarations.size()); //$NON-NLS-1$
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("Not a method declaration", bodyDeclaration instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- assertEquals("Wrong name", "m", methodDeclaration.getName().getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10698
- */
- public void test0265() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0265", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
- */
- public void test0266() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0266", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "Inner\\u005b]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type type2 = arrayType.getElementType();
- assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type2;
- checkSourceRange(simpleType, "Inner", source); //$NON-NLS-1$
- Name name = simpleType.getName();
- assertTrue("not a simple name", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- checkSourceRange(simpleName, "Inner", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
- */
- public void test0267() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0267", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "Inner[]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type type2 = arrayType.getElementType();
- assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type2;
- checkSourceRange(simpleType, "Inner", source); //$NON-NLS-1$
- Name name = simpleType.getName();
- assertTrue("not a simple name", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- checkSourceRange(simpleName, "Inner", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
- */
- public void test0268() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0268", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "test0268.Test.Inner[]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type type2 = arrayType.getElementType();
- assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type2;
- checkSourceRange(simpleType, "test0268.Test.Inner", source); //$NON-NLS-1$
- Name name = simpleType.getName();
- assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(name, "test0268.Test.Inner", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
- */
- public void test0269() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0269", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "test0269.Test.Inner[/**/]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type type2 = arrayType.getElementType();
- assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type2;
- checkSourceRange(simpleType, "test0269.Test.Inner", source); //$NON-NLS-1$
- Name name = simpleType.getName();
- assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(name, "test0269.Test.Inner", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
- */
- public void test0270() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0270", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "test0270.Test.Inner", source); //$NON-NLS-1$
- assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(name, "test0270.Test.Inner", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
- */
- public void test0271() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0271", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "test0271.Test.Inner[]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type type2 = arrayType.getElementType();
- assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type2;
- checkSourceRange(simpleType, "test0271.Test.Inner", source); //$NON-NLS-1$
- Name name = simpleType.getName();
- assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- checkSourceRange(name, "test0271.Test.Inner", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843
- */
- public void test0272() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0272", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a For statement", node instanceof ForStatement); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- checkSourceRange(forStatement, "for (int i= 0; i < 10; i++) foo();", source); //$NON-NLS-1$
- Statement action = forStatement.getBody();
- checkSourceRange(action, "foo();", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843
- */
- public void test0273() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0273", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a For statement", node instanceof ForStatement); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- checkSourceRange(forStatement, "for (int i= 0; i < 10; i++) { foo(); }", source); //$NON-NLS-1$
- Statement action = forStatement.getBody();
- checkSourceRange(action, "{ foo(); }", source); //$NON-NLS-1$
- assertTrue("Not a block", action instanceof Block); //$NON-NLS-1$
- Block block = (Block) action;
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(0);
- checkSourceRange(stmt, "foo();", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843
- */
- public void test0274() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0274", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not a While statement", node instanceof WhileStatement); //$NON-NLS-1$
- WhileStatement whileStatement = (WhileStatement) node;
- checkSourceRange(whileStatement, "while (i < 10) { foo(i++); }", source); //$NON-NLS-1$
- Statement action = whileStatement.getBody();
- checkSourceRange(action, "{ foo(i++); }", source); //$NON-NLS-1$
- assertTrue("Not a block", action instanceof Block); //$NON-NLS-1$
- Block block = (Block) action;
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(0);
- checkSourceRange(stmt, "foo(i++);", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843
- */
- public void test0275() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0275", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not a While statement", node instanceof WhileStatement); //$NON-NLS-1$
- WhileStatement whileStatement = (WhileStatement) node;
- checkSourceRange(whileStatement, "while (i < 10) foo(i++);", source); //$NON-NLS-1$
- Statement action = whileStatement.getBody();
- checkSourceRange(action, "foo(i++);", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10798
- */
- public void test0276() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0276", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- String expectedSource =
- "public void foo() {\n" + //$NON-NLS-1$
- " foo();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration, expectedSource, source);
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " foo();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration.getBody(), expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10798
- */
- public void test0277() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0277", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- String expectedSource =
- "public void foo() {\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration, expectedSource, source);
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration.getBody(), expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10861
- */
- public void test0278() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0278", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "Class c = java.lang.String.class;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a type literal", expression instanceof TypeLiteral); //$NON-NLS-1$
- ITypeBinding typeBinding = expression.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10861
- */
- public void test0279() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0279", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0,0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- checkSourceRange(variableDeclarationStatement, "Class c = java.lang.String.class;", source); //$NON-NLS-1$
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a type literal", expression instanceof TypeLiteral); //$NON-NLS-1$
- ITypeBinding typeBinding = expression.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10865
- * Check well known types
- */
- public void test0280() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0280", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- AST newAst = result.getAST();
- ITypeBinding typeBinding = newAst.resolveWellKnownType("boolean"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("char"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "char", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("byte"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "byte", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("short"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "short", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("int"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("long"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "long", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("float"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "float", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("double"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "double", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("void"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "void", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Object", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.String"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "String", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.StringBuffer"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "StringBuffer", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.Throwable"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Throwable", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.Exception"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Exception", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.RuntimeException"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "RuntimeException", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.Error"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Error", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.Class"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("java.lang.Runnable"); //$NON-NLS-1$
- assertNull("typeBinding not null", typeBinding); //$NON-NLS-1$
- typeBinding = newAst.resolveWellKnownType("java.lang.Cloneable"); //$NON-NLS-1$
- assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
- typeBinding = newAst.resolveWellKnownType("java.io.Serializable"); //$NON-NLS-1$
- assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
- typeBinding = newAst.resolveWellKnownType("java.lang.Boolean"); //$NON-NLS-1$
- assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
- typeBinding = newAst.resolveWellKnownType("java.lang.Byte"); //$NON-NLS-1$
- assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
- typeBinding = newAst.resolveWellKnownType("java.lang.Character"); //$NON-NLS-1$
- assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
- typeBinding = newAst.resolveWellKnownType("java.lang.Double"); //$NON-NLS-1$
- assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
- typeBinding = newAst.resolveWellKnownType("java.lang.Float"); //$NON-NLS-1$
- assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
- typeBinding = newAst.resolveWellKnownType("java.lang.Integer"); //$NON-NLS-1$
- assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
- typeBinding = newAst.resolveWellKnownType("java.lang.Long"); //$NON-NLS-1$
- assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
- typeBinding = newAst.resolveWellKnownType("java.lang.Short"); //$NON-NLS-1$
- assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
- typeBinding = newAst.resolveWellKnownType("java.lang.Void"); //$NON-NLS-1$
- assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0281() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0281", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "Object o= /*]*/new Object()/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "new Object()", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0282() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0282", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "boolean b = /*]*/true/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "true", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0283() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0283", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "char c = /*]*/'c'/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "'c'", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0284() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0284", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "Object o = /*]*/null/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "null", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0285() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0285", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "Object o = /*]*/Object.class/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "Object.class", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0286() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0286", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "int i = /**/(2)/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "(2)", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0287() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0287", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "String[] tab = /**/new String[3]/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "new String[3]", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0288() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0288", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "String[] tab = /**/{ }/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "{ }", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0289() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0289", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "String s = /**/tab1[0]/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "tab1[0]", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0290() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0290", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "Object o = /*]*/new java.lang.Object()/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "new java.lang.Object()", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10898
- */
- public void test0291() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0291", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("no errors", 1, unit.getMessages().length); //$NON-NLS-1$
- assertEquals("no errors", 1, unit.getProblems().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10913
- */
- public void test0292() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0292", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not a qualifiedName", expression instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) expression;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("Wrong name", "x", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("NO binding", binding); //$NON-NLS-1$
- assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$
- assertEquals("wrong name", "x", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Name name = qualifiedName.getQualifier();
- assertTrue("Not a simpleName", name instanceof SimpleName); //$NON-NLS-1$
- SimpleName simpleName2 = (SimpleName) name;
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertTrue("Not a type binding", binding2 instanceof ITypeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Test", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10933
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10935
- */
- public void test0293() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0293", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$
- String expectedSource =
- "{\n" + //$NON-NLS-1$
- " public void run() {\n" + //$NON-NLS-1$
- " /*]*/foo();/*[*/\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(anonymousClassDeclaration, expectedSource, source);
- expectedSource =
- "run= new Runnable() {\n" + //$NON-NLS-1$
- " public void run() {\n" + //$NON-NLS-1$
- " /*]*/foo();/*[*/\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(variableDeclarationFragment, expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984
- */
- public void test0294() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0294", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- String expectedSource =
- "public void fails() {\n" + //$NON-NLS-1$
- " foo()\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration, expectedSource, source);
- Block block = methodDeclaration.getBody();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " foo()\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(block, expectedSource, source);
- node = getASTNode(compilationUnit, 0, 1);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10986
- */
- public void test0295() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0295", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("Wrong size", 2, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertEquals("Wrong size", 2, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("not a method invocation", expression instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- ITypeBinding typeBinding = methodInvocation.resolveTypeBinding();
- assertNull("type binding is not null", typeBinding); //$NON-NLS-1$
- }
-
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984
- */
- public void test0296() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0296", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- String expectedSource =
- "public void fails() {\n" + //$NON-NLS-1$
- " foo()\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration, expectedSource, source);
- Block block = methodDeclaration.getBody();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " foo()\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(block, expectedSource, source);
- node = getASTNode(compilationUnit, 0, 1);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11037
- */
- public void test0297() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0297", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- runConversion(AST.JLS3, sourceUnit, false);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984
- */
- public void test0298() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0298", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a ReturnStatement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- checkSourceRange(expression, "a().length != 3", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104
- */
- public void test0299() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0299", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "int i = (/**/2/**/);", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a parenthesized expression", expression instanceof ParenthesizedExpression); //$NON-NLS-1$
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression;
- Expression expression2 = parenthesizedExpression.getExpression();
- checkSourceRange(expression2, "2", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104
- */
- public void test0300() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0300", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "boolean b = /**/true/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "true", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104
- */
- public void test0301() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0301", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "Object o = /**/null/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "null", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11106
- */
- public void test0302() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0302", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a DoStatement", node instanceof DoStatement); //$NON-NLS-1$
- DoStatement doStatement = (DoStatement) node;
- String expectedSource =
- "do\n" + //$NON-NLS-1$
- " foo();\n" + //$NON-NLS-1$
- " while(1 < 10);"; //$NON-NLS-1$
- checkSourceRange(doStatement, expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11129
- */
- public void test0303() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0303", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression2 = expressionStatement.getExpression();
- assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11151
- */
- public void test0304() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0304", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- checkSourceRange(node, "public void foo(int arg);", source); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- assertNull("Has a body", block); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11125
- */
- public void test0305() {
- char[] source =
- ("package test0305;\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- "class Test {\n" + //$NON-NLS-1$
- " public void foo(int arg) {}\n" + //$NON-NLS-1$
- "}").toCharArray(); //$NON-NLS-1$
- IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$
- ASTNode result = runConversion(AST.JLS3, source, "Test.js", project, true); //$NON-NLS-1$
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0);
- assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong package", "test0305", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Not an interface", typeBinding.isClass()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11125
- */
- public void test0306() {
- char[] source =
- ("package java.lang;\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- "class Object {\n" + //$NON-NLS-1$
- " public void foo(int arg) {}\n" + //$NON-NLS-1$
- "}").toCharArray(); //$NON-NLS-1$
- IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$
- ASTNode result = runConversion(AST.JLS3, source, "Object.js", project, true); //$NON-NLS-1$
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0);
- assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Object", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong package", "java.lang", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Not an interface", typeBinding.isClass()); //$NON-NLS-1$
- assertEquals("Wrong size", 2, typeBinding.getDeclaredMethods().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11371
- */
- public void test0307() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0307", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- assertNotNull("No body", block); //$NON-NLS-1$
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not a super constructor invocation", statement instanceof SuperConstructorInvocation); //$NON-NLS-1$
- checkSourceRange(statement, "super(10);", source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11371
- */
- public void test0308() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0308", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- assertNotNull("No body", block); //$NON-NLS-1$
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not a super constructor invocation", statement instanceof SuperConstructorInvocation); //$NON-NLS-1$
- SuperConstructorInvocation superConstructorInvocation = (SuperConstructorInvocation) statement;
- IFunctionBinding methodBinding = superConstructorInvocation.resolveConstructorBinding();
- assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$
- IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding();
- assertNotNull("No methodBinding2", methodBinding2); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11380
- */
- public void test0309() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0309", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a conditional expression", expression instanceof ConditionalExpression); //$NON-NLS-1$
- ConditionalExpression conditionalExpression = (ConditionalExpression) expression;
- ITypeBinding typeBinding = conditionalExpression.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11380
- */
- public void test0310() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0310", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a qualified name", expression instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) expression;
- Name qualifier = qualifiedName.getQualifier();
- IBinding binding = qualifier.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong name", "I", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11638
- */
- public void test0311() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0311", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$
- List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
- assertEquals("wrong size for body declarations", 1, bodyDeclarations.size()); //$NON-NLS-1$
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("Not a method declaration", bodyDeclaration instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- assertNotNull("no body", block); //$NON-NLS-1$
- List statements = block.statements();
- assertEquals("Wrong size for statements", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("not a variable declaration statement", statement instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement2 = (VariableDeclarationStatement) statement;
- List fragments2 = variableDeclarationStatement2.fragments();
- assertEquals("wrong size for fragments2", 1, fragments2.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment2 = (VariableDeclarationFragment) fragments2.get(0);
- Expression expression2 = variableDeclarationFragment2.getInitializer();
- assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$
- Name name = (Name) expression2;
- checkSourceRange(name, "j", source); //$NON-NLS-1$
- IBinding binding = name.resolveBinding();
- ASTNode declaringNode = compilationUnit.findDeclaringNode(binding);
- assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$
- checkSourceRange(declaringNode, "int j", source); //$NON-NLS-1$
- assertTrue("Not a single variable declaration", declaringNode instanceof SingleVariableDeclaration); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11638
- * There is a error in this source. A is unresolved. Then there is no
- * declaring node.
- */
- public void test0312() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0312", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$
- List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
- assertEquals("wrong size for body declarations", 1, bodyDeclarations.size()); //$NON-NLS-1$
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("Not a method declaration", bodyDeclaration instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- assertNotNull("no body", block); //$NON-NLS-1$
- List statements = block.statements();
- assertEquals("Wrong size for statements", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("not a variable declaration statement", statement instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement2 = (VariableDeclarationStatement) statement;
- List fragments2 = variableDeclarationStatement2.fragments();
- assertEquals("wrong size for fragments2", 1, fragments2.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment2 = (VariableDeclarationFragment) fragments2.get(0);
- Expression expression2 = variableDeclarationFragment2.getInitializer();
- assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$
- Name name = (Name) expression2;
- checkSourceRange(name, "j", source); //$NON-NLS-1$
- IBinding binding = name.resolveBinding();
- ASTNode declaringNode = compilationUnit.findDeclaringNode(binding);
- assertNull("No declaring node is available", declaringNode); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11659
- */
- public void test0313() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0313", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an InfixExpression", expression instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "i+j", source); //$NON-NLS-1$
- Expression expression2 = infixExpression.getLeftOperand();
- checkSourceRange(expression2, "i", source); //$NON-NLS-1$
- assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$
- Name name = (Name) expression2;
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- ASTNode astNode = compilationUnit.findDeclaringNode(binding);
- assertNotNull("No declaring node", astNode); //$NON-NLS-1$
- checkSourceRange(astNode, "int i", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=12326
- */
- public void test0314() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0314", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertNotNull("No result", result); //$NON-NLS-1$
- assertTrue("Not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("Wrong line number", 1, compilationUnit.getLineNumber(0)); //$NON-NLS-1$
- // ensure that last character is on the last line
- assertEquals("Wrong line number", 3, compilationUnit.getLineNumber(source.length - 1)); //$NON-NLS-1$
- // source.length is beyond the size of the compilation unit source
- assertEquals("Wrong line number", -1, compilationUnit.getLineNumber(source.length)); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=12326
- */
- public void test0315() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0315", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a Return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not an instanceof expression", expression instanceof InstanceofExpression); //$NON-NLS-1$
- InstanceofExpression instanceOfExpression = (InstanceofExpression) expression;
- Type rightOperand = instanceOfExpression.getRightOperand();
- assertTrue("Not a simpleType", rightOperand instanceof SimpleType); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) rightOperand;
- Name n = simpleType.getName();
- assertTrue("Not a qualified name", n instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName name = (QualifiedName) n;
- checkSourceRange(name, "java.io.Serializable", source); //$NON-NLS-1$
- ITypeBinding typeBinding = name.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Serializable", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Name qualifier = name.getQualifier();
- assertTrue("Not a qualified name", qualifier instanceof QualifiedName); //$NON-NLS-1$
- ITypeBinding typeBinding2 = qualifier.resolveTypeBinding();
- assertNull("typebinding2 is not null", typeBinding2); //$NON-NLS-1$
- IBinding binding = qualifier.resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$
- IPackageBinding pBinding = (IPackageBinding) binding;
- assertEquals("Wrong name", "java.io", pBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=12454
- */
- public void test0316() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Hello.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No result", result); //$NON-NLS-1$
- assertTrue("Not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("Wrong size", 1, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertEquals("Wrong size", 1, compilationUnit.getProblems().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=12781
- */
- public void test0317() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0317", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("not an instanceof expression", expression instanceof InstanceofExpression); //$NON-NLS-1$
- InstanceofExpression instanceOfExpression = (InstanceofExpression) expression;
- Expression left = instanceOfExpression.getLeftOperand();
- assertTrue("Not a Name", left instanceof Name); //$NON-NLS-1$
- Name name = (Name) left;
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong name", "x", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding = name.resolveTypeBinding();
- assertNotNull("No typebinding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong type", "Object", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type right = instanceOfExpression.getRightOperand();
- assertTrue("Not a simpleType", right instanceof SimpleType); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) right;
- name = simpleType.getName();
- assertTrue("Not a simpleName", name instanceof SimpleName); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- IBinding binding2 = simpleName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
- assertNotNull("No typeBinding2", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13233
- */
- public void test0318() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0318", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("No error", 1, unit.getMessages().length); //$NON-NLS-1$
- assertEquals("No error", 1, unit.getProblems().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0319() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0319", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an array creation", expression instanceof ArrayCreation); //$NON-NLS-1$
- ArrayCreation arrayCreation = (ArrayCreation) expression;
- ITypeBinding typeBinding = arrayCreation.resolveTypeBinding();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ArrayType arrayType = arrayCreation.getType();
- ITypeBinding typeBinding2 = arrayType.resolveBinding();
- assertNotNull("no type binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type type = arrayType.getElementType();
- assertTrue("Not a simple type", type instanceof SimpleType); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- ITypeBinding typeBinding3 = simpleType.resolveBinding();
- assertNotNull("no type binding3", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0320() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0320", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "int[]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding typeBinding = arrayType.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- Type elementType = arrayType.getElementType();
- assertTrue("Not a simple type", elementType.isPrimitiveType()); //$NON-NLS-1$
- ITypeBinding typeBinding2 = elementType.resolveBinding();
- assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0321() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0321", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding typeBinding = arrayType.resolveBinding();
- checkSourceRange(type, "java.lang.Object[][]", source); //$NON-NLS-1$
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- Type elementType = arrayType.getComponentType();
- ITypeBinding typeBinding2 = elementType.resolveBinding();
- assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("wrong dimension", 1, typeBinding2.getDimensions()); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Not an array type", elementType.isArrayType()); //$NON-NLS-1$
- Type elementType2 = ((ArrayType) elementType).getComponentType();
- assertTrue("Not a simple type", elementType2.isSimpleType()); //$NON-NLS-1$
- ITypeBinding typeBinding3 = elementType2.resolveBinding();
- assertNotNull("No type binding3", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong dimension", 0, typeBinding3.getDimensions()); //$NON-NLS-1$
- assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13231
- */
- public void test0322() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0322", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a FieldDeclaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a null literal", expression instanceof NullLiteral); //$NON-NLS-1$
- NullLiteral nullLiteral = (NullLiteral) expression;
- ITypeBinding typeBinding = nullLiteral.resolveTypeBinding();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not the null type", typeBinding.isNullType()); //$NON-NLS-1$
- assertEquals("Wrong qualified name", typeBinding.getQualifiedName(), "null"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14198
- */
- public void test0323() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0323", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression2 = expressionStatement.getExpression();
- assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14198
- */
- public void test0324() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0324", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression2 = expressionStatement.getExpression();
- assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14198
- */
- public void test0325() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0325", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression2 = expressionStatement.getExpression();
- assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14217
- */
- public void test0326() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0326", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- checkSourceRange(expressionStatement.getExpression(), "a().f= a()", source); //$NON-NLS-1$
- checkSourceRange(expressionStatement, "a().f= a();", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14198
- */
- public void test0327() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0327", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("Wrong number of errors", 2, compilationUnit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not an VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0328() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0328", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "java.lang.Object[]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding typeBinding = arrayType.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type elementType = arrayType.getElementType();
- assertTrue("Not a simple type", elementType.isSimpleType()); //$NON-NLS-1$
- ITypeBinding typeBinding2 = elementType.resolveBinding();
- assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("wrong name", "Object", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a array creation", expression instanceof ArrayCreation); //$NON-NLS-1$
- ITypeBinding typeBinding3 = expression.resolveTypeBinding();
- assertNotNull("No typeBinding3", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ArrayCreation arrayCreation = (ArrayCreation) expression;
- ArrayInitializer arrayInitializer = arrayCreation.getInitializer();
- assertNotNull("not array initializer", arrayInitializer); //$NON-NLS-1$
- ITypeBinding typeBinding4 = arrayInitializer.resolveTypeBinding();
- assertNotNull("No typeBinding4", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0329() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0329", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "java.lang.Object[]", source); //$NON-NLS-1$
- assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding typeBinding = arrayType.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type elementType = arrayType.getElementType();
- assertTrue("Not a simple type", elementType.isSimpleType()); //$NON-NLS-1$
- ITypeBinding typeBinding2 = elementType.resolveBinding();
- assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("wrong name", "Object", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a array creation", expression instanceof ArrayCreation); //$NON-NLS-1$
- ITypeBinding typeBinding3 = expression.resolveTypeBinding();
- assertNotNull("No typeBinding3", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ArrayCreation arrayCreation = (ArrayCreation) expression;
- ArrayInitializer arrayInitializer = arrayCreation.getInitializer();
- assertNotNull("not array initializer", arrayInitializer); //$NON-NLS-1$
- ITypeBinding typeBinding4 = arrayInitializer.resolveTypeBinding();
- assertNotNull("No typeBinding4", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14313
- */
- public void test0330() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0330", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("wrong size", 2, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertEquals("wrong size", 2, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- IFunctionBinding[] methods = typeBinding.getDeclaredMethods();
- assertEquals("wrong size", 1, methods.length); //$NON-NLS-1$
- assertTrue("not a constructor", methods[0].isConstructor()); //$NON-NLS-1$
- assertTrue("wrong name", !methods[0].getName().equals("foo")); //$NON-NLS-1$ //$NON-NLS-2$
- node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a methodDeclaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertNull("method binding not null", methodBinding); //$NON-NLS-1$
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- ITypeBinding typeBinding2 = expression.resolveTypeBinding();
- assertNotNull("no type binding2", typeBinding2); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14322
- */
- public void test0331() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0331", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not an VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a QualifiedName", expression instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) expression;
- IBinding binding = qualifiedName.getName().resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind()); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertTrue("Not a field", variableBinding.isField()); //$NON-NLS-1$
- assertNull("Got a declaring class", variableBinding.getDeclaringClass()); //$NON-NLS-1$
- assertEquals("wrong name", "length", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14403
- */
- public void test0332() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0332", "LocalSelectionTransfer.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0333() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0333", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an array creation", expression instanceof ArrayCreation); //$NON-NLS-1$
- ArrayCreation arrayCreation = (ArrayCreation) expression;
- ITypeBinding typeBinding = arrayCreation.resolveTypeBinding();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "Object[][]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ArrayType arrayType = arrayCreation.getType();
- ITypeBinding typeBinding2 = arrayType.resolveBinding();
- assertNotNull("no type binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("wrong name", "Object[][]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type type = arrayType.getElementType();
- assertTrue("Not a simple type", type instanceof SimpleType); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- ITypeBinding typeBinding3 = simpleType.resolveBinding();
- assertNotNull("no type binding3", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- type = arrayType.getComponentType();
- assertTrue("Not an array type", type instanceof ArrayType); //$NON-NLS-1$
- ArrayType arrayType2 = (ArrayType) type;
- ITypeBinding typeBinding4 = arrayType2.resolveBinding();
- assertNotNull("no type binding4", typeBinding4); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0334() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0334", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an array creation", expression instanceof ArrayCreation); //$NON-NLS-1$
- ArrayCreation arrayCreation = (ArrayCreation) expression;
- ITypeBinding typeBinding = arrayCreation.resolveTypeBinding();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "Object[][][]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ArrayType arrayType = arrayCreation.getType();
- checkSourceRange(arrayType, "Object[10][][]", source); //$NON-NLS-1$
- ITypeBinding typeBinding2 = arrayType.resolveBinding();
- assertNotNull("no type binding2", typeBinding2); //$NON-NLS-1$
- assertEquals("wrong name", "Object[][][]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Type type = arrayType.getElementType();
- assertTrue("Not a simple type", type instanceof SimpleType); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- checkSourceRange(simpleType, "Object", source); //$NON-NLS-1$
- ITypeBinding typeBinding3 = simpleType.resolveBinding();
- assertNotNull("no type binding3", typeBinding3); //$NON-NLS-1$
- assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- type = arrayType.getComponentType();
- assertTrue("Not an array type", type instanceof ArrayType); //$NON-NLS-1$
- ArrayType arrayType2 = (ArrayType) type;
- checkSourceRange(arrayType2, "Object[10][]", source); //$NON-NLS-1$
- ITypeBinding typeBinding4 = arrayType2.resolveBinding();
- assertNotNull("no type binding4", typeBinding4); //$NON-NLS-1$
- assertEquals("wrong name", "Object[][]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- type = arrayType2.getComponentType();
- assertTrue("Not an array type", type instanceof ArrayType); //$NON-NLS-1$
- ArrayType arrayType3 = (ArrayType) type;
- ITypeBinding typeBinding5 = arrayType3.resolveBinding();
- assertNotNull("no type binding5", typeBinding5); //$NON-NLS-1$
- assertEquals("wrong name", "Object[]", typeBinding5.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(arrayType3, "Object[10]", source); //$NON-NLS-1$
- }
-
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14526
- */
- public void test0335() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0335", "ExceptionTestCaseTest.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0);
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertEquals("errors found", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- Type superclassType = typeDeclaration.getSuperclassType();
- assertNotNull("no super class", superclassType); //$NON-NLS-1$
- assertEquals("Wrong type", superclassType.getNodeType(), ASTNode.SIMPLE_TYPE);
- SimpleType simpleType = (SimpleType) superclassType;
- Name name = simpleType.getName();
- assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) name;
- name = qualifiedName.getQualifier();
- assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- qualifiedName = (QualifiedName) name;
- name = qualifiedName.getQualifier();
- assertTrue("not a simple name", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$
- assertEquals("wrong name", "junit", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14526
- */
- public void test0336() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0336", "SorterTest.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertEquals("errors found", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14602
- */
- public void test0337() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0337", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- checkSourceRange(variableDeclarationFragment, "message= Test.m(\"s\", new String[]{\"g\"})", source); //$NON-NLS-1$
- checkSourceRange(fieldDeclaration, "String message= Test.m(\"s\", new String[]{\"g\"});", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14852
- */
- public void test0338() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0338", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List thrownExceptions = methodDeclaration.thrownExceptions();
- assertEquals("Wrong size", 1, thrownExceptions.size()); //$NON-NLS-1$
- Name name = (Name) thrownExceptions.get(0);
- IBinding binding = name.resolveBinding();
- assertEquals("wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertEquals("wrong name", "IOException", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=15061
- */
- public void test0339() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0339", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No errors found", 3, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("wrong size", 1, bodyDeclarations.size()); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclarations.get(0);
- checkSourceRange(methodDeclaration, "int doQuery(boolean x);", source); //$NON-NLS-1$
- node = getASTNode(compilationUnit, 0, 1);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- String expectedSource =
- "public void setX(boolean x) {\n" + //$NON-NLS-1$
- " {\n" + //$NON-NLS-1$
- " z\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- int methodEndPosition = node.getStartPosition() + node.getLength();
- node = getASTNode(compilationUnit, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- int typeEndPosition = node.getStartPosition() + node.getLength();
- assertEquals("different positions", methodEndPosition, typeEndPosition); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14852
- */
- public void test0340() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "p3", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not an method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertNotNull("No receiver", expression2); //$NON-NLS-1$
- ITypeBinding binding = expression2.resolveTypeBinding();
- assertNotNull("No type binding", binding); //$NON-NLS-1$
- assertEquals("wrong name", "A", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong name", "p2", binding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Not a qualified name", expression2.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) expression2;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("wrong name", "A", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding = simpleName.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "A", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong name", "p2", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Name name = qualifiedName.getQualifier();
- assertTrue("Not a simple name", name.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName2 = (SimpleName) name;
- assertEquals("wrong name", "p2", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("No binding", binding2); //$NON-NLS-1$
- assertEquals("wrong type", IBinding.PACKAGE, binding2.getKind()); //$NON-NLS-1$
- assertEquals("wrong name", "p2", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- node = getASTNode(compilationUnit, 0, 1, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement2 = (ExpressionStatement) node;
- Expression expression3 = expressionStatement2.getExpression();
- assertTrue("Not an method invocation", expression3.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation2 = (FunctionInvocation) expression3;
- Expression expression4 = methodInvocation2.getExpression();
- assertNotNull("No receiver", expression4); //$NON-NLS-1$
- ITypeBinding binding3 = expression4.resolveTypeBinding();
- assertNotNull("No type binding", binding3); //$NON-NLS-1$
- assertEquals("wrong name", "A", binding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong name", "p1", binding3.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=15804
- */
- public void test0341() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0341", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- String expectedSource =
- "if (field != null) {\n" + //$NON-NLS-1$
- " throw new IOException();\n" + //$NON-NLS-1$
- " } else if (field == null) {\n" + //$NON-NLS-1$
- " throw new MalformedURLException();\n" + //$NON-NLS-1$
- " } else if (field == null) {\n" + //$NON-NLS-1$
- " throw new InterruptedIOException();\n" + //$NON-NLS-1$
- " } else {\n" + //$NON-NLS-1$
- " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- IfStatement ifStatement = (IfStatement) node;
- Statement thenStatement = ifStatement.getThenStatement();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " throw new IOException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(thenStatement, expectedSource, source);
- Statement elseStatement = ifStatement.getElseStatement();
- expectedSource =
- "if (field == null) {\n" + //$NON-NLS-1$
- " throw new MalformedURLException();\n" + //$NON-NLS-1$
- " } else if (field == null) {\n" + //$NON-NLS-1$
- " throw new InterruptedIOException();\n" + //$NON-NLS-1$
- " } else {\n" + //$NON-NLS-1$
- " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(elseStatement, expectedSource, source);
- assertTrue("Not a if statement", elseStatement.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- ifStatement = (IfStatement) elseStatement;
- thenStatement = ifStatement.getThenStatement();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " throw new MalformedURLException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(thenStatement, expectedSource, source);
- elseStatement = ifStatement.getElseStatement();
- expectedSource =
- "if (field == null) {\n" + //$NON-NLS-1$
- " throw new InterruptedIOException();\n" + //$NON-NLS-1$
- " } else {\n" + //$NON-NLS-1$
- " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(elseStatement, expectedSource, source);
- assertTrue("Not a if statement", elseStatement.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- ifStatement = (IfStatement) elseStatement;
- thenStatement = ifStatement.getThenStatement();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " throw new InterruptedIOException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(thenStatement, expectedSource, source);
- elseStatement = ifStatement.getElseStatement();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(elseStatement, expectedSource, source);
- }
-
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=15657
-// * @deprecated marked deprecated to suppress JDOM-related deprecation warnings
-// */
-// public void test0342() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0342", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// IDOMCompilationUnit dcompUnit = new DOMFactory().createCompilationUnit(sourceUnit.getSource(), sourceUnit.getElementName());
-// assertNotNull("dcompUnit is null", dcompUnit); //$NON-NLS-1$
-//
-// // searching class
-// IDOMType classNode = null;
-// Enumeration children = dcompUnit.getChildren();
-// assertNotNull("dcompUnit has no children", children); //$NON-NLS-1$
-//
-// while (children.hasMoreElements()) {
-// IDOMNode child = (IDOMNode) children.nextElement();
-// if (child.getNodeType() == IDOMNode.TYPE) {
-// classNode = (IDOMType) child;
-// break;
-// }
-// }
-// assertNotNull("classNode is null", classNode); //$NON-NLS-1$
-//
-// // searching for methods
-// children = classNode.getChildren();
-//
-// assertNotNull("classNode has no children", children); //$NON-NLS-1$
-//
-// while (children.hasMoreElements()) {
-// IDOMNode child = (IDOMNode) children.nextElement();
-// if (child.getNodeType() == IDOMNode.METHOD) {
-// IDOMMethod childMethod = (IDOMMethod) child;
-//
-// // returnType is always null;
-// String returnType = childMethod.getReturnType();
-// if (childMethod.isConstructor()) {
-// assertNull(returnType);
-// } else {
-// assertNotNull("no return type", returnType); //$NON-NLS-1$
-// }
-// }
-// }
-// }
-//
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=16051
- */
- public void test0343() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0343", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 1);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- String expectedSource =
- "if (flag)\n" + //$NON-NLS-1$
- " i= 10;"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=16132
- */
- public void test0344() throws JavaScriptModelException {
- IJavaScriptProject project = null;
- String pb_assert = null;
- String compiler_source = null;
- String compiler_compliance = null;
- try {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0344", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- project = sourceUnit.getJavaScriptProject();
- pb_assert = project.getOption(JavaScriptCore.COMPILER_PB_ASSERT_IDENTIFIER, true);
- compiler_source = project.getOption(JavaScriptCore.COMPILER_SOURCE, true);
- compiler_compliance = project.getOption(JavaScriptCore.COMPILER_COMPLIANCE, true);
- project.setOption(JavaScriptCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaScriptCore.ERROR);
- project.setOption(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- project.setOption(JavaScriptCore.COMPILER_COMPLIANCE, JavaScriptCore.VERSION_1_4);
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- } finally {
- if (project != null) {
- project.setOption(JavaScriptCore.COMPILER_PB_ASSERT_IDENTIFIER, pb_assert);
- project.setOption(JavaScriptCore.COMPILER_SOURCE, compiler_source);
- project.setOption(JavaScriptCore.COMPILER_COMPLIANCE, compiler_compliance);
- }
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=17922
- */
- public void test0345() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0345", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an ArrayCreation", expression.getNodeType() == ASTNode.ARRAY_CREATION); //$NON-NLS-1$
- ArrayCreation arrayCreation = (ArrayCreation) expression;
- ArrayType arrayType = arrayCreation.getType();
- IBinding binding2 = arrayType.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertEquals("not a type", binding2.getKind(), IBinding.TYPE); //$NON-NLS-1$
- ITypeBinding typeBinding2 = (ITypeBinding) binding2;
- assertTrue("Not an array type binding2", typeBinding2.isArray()); //$NON-NLS-1$
- Type type = arrayType.getElementType();
- assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("QualifiedName", name.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$
- SimpleName simpleName = ((QualifiedName) name).getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("not a type", binding.getKind(), IBinding.TYPE); //$NON-NLS-1$
- ITypeBinding typeBinding = (ITypeBinding) binding;
- assertTrue("An array type binding", !typeBinding.isArray()); //$NON-NLS-1$
- Type type2 = fieldDeclaration.getType();
- assertTrue("Not a array type", type2.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType2 = (ArrayType) type2;
- Type type3 = arrayType2.getElementType();
- assertTrue("Not a simple type", type3.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType2 = (SimpleType) type3;
- Name name2 = simpleType2.getName();
- assertTrue("Not a qualified name", name2.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$
- SimpleName simpleName2 = ((QualifiedName) name2).getName();
- IBinding binding3 = simpleName2.resolveBinding();
- assertNotNull("no binding", binding3); //$NON-NLS-1$
- assertEquals("not a type", binding3.getKind(), IBinding.TYPE); //$NON-NLS-1$
- ITypeBinding typeBinding3 = (ITypeBinding) binding3;
- assertTrue("An array type binding", !typeBinding3.isArray()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0346() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0346", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "Vector", source); //$NON-NLS-1$
- assertTrue("not an array type", !type.isArrayType()); //$NON-NLS-1$
- assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("Not a simpleName", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- ITypeBinding typeBinding = (ITypeBinding) binding;
- assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding2 = simpleType.resolveBinding();
- assertNotNull("No binding", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, typeBinding2.getKind()); //$NON-NLS-1$
- assertTrue("An array", !typeBinding2.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0347() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0347", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "Vector[]", source); //$NON-NLS-1$
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding binding = arrayType.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector[]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0348() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0348", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "Vector[][]", source); //$NON-NLS-1$
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding binding = arrayType.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector[][]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0349() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0349", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Vector[][]", source); //$NON-NLS-1$
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding binding = arrayType.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector[][]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0350() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0350", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Vector", source); //$NON-NLS-1$
- assertTrue("not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- ITypeBinding binding = simpleType.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("An array type", binding.isClass()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18169
- */
- public void test0351() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0351", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(singleVariableDeclaration, "int a", source); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1);
- checkSourceRange(singleVariableDeclaration, "int[] b", source); //$NON-NLS-1$
- node = getASTNode(compilationUnit, 0, 1);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(singleVariableDeclaration, "int a", source); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1);
- checkSourceRange(singleVariableDeclaration, "int b[]", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18169
- */
- public void test0352() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0352", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(singleVariableDeclaration, "final int a", source); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1);
- checkSourceRange(singleVariableDeclaration, "final int[] b", source); //$NON-NLS-1$
- node = getASTNode(compilationUnit, 0, 1);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(singleVariableDeclaration, "final int a", source); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1);
- checkSourceRange(singleVariableDeclaration, "final int b[]", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18042
- */
- public void test0353() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0353", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "InputStream", source); //$NON-NLS-1$
- assertTrue("not a simple type", type.isSimpleType()); //$NON-NLS-1$
- ITypeBinding binding = type.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("Not a class", binding.isClass()); //$NON-NLS-1$
- assertEquals("Wrong name", "InputStream", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong package", "java.io", binding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- IBinding binding2 = name.resolveBinding();
- assertNotNull("No binding", binding2); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding2.getKind()); //$NON-NLS-1$
- ITypeBinding typeBinding = (ITypeBinding) binding2;
- assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
- assertEquals("Wrong name", "InputStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong package", "java.io", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=19851
- */
- public void test0354() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0354", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 2, compilationUnit.getMessages().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=20520
- */
- public void test0355() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0355", "Foo.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node;
- Expression condition = ifStatement.getExpression();
- assertTrue("Not an infixExpression", condition.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) condition;
- Expression expression = infixExpression.getLeftOperand();
- assertTrue("Not a method invocation expression", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a parenthesis expression", expression2.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=20865
- */
- public void test0356() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0356", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 1, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- ITypeBinding binding = type.resolveBinding();
- assertNotNull("Binding should NOT be null for type: "+type, binding);
-
- // Verify that class instance creation has a null binding
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Expect only one fragment for VariableDeclarationStatement: "+variableDeclarationStatement, 1, fragments.size());
- node = (ASTNode) fragments.get(0);
- assertEquals("Not a variable declaration fragment", ASTNode.VARIABLE_DECLARATION_FRAGMENT, node.getNodeType()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) node;
- Expression initializer = fragment.getInitializer();
- assertEquals("Expect a class instance creation for initializer: "+initializer, ASTNode.CLASS_INSTANCE_CREATION, initializer.getNodeType()); //$NON-NLS-1$
- ClassInstanceCreation instanceCreation = (ClassInstanceCreation) initializer;
- type = instanceCreation.getType();
- binding = type.resolveBinding();
- assertNull("Binding should BE null for type: "+type, binding);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21757
- */
- public void test0357() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0357", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration statement", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- SimpleName name = typeDeclaration.getName();
- checkSourceRange(name, "A", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21768
- */
- public void test0358() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0358", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0,0);
- assertNotNull(node);
- assertTrue("Not a method declaration statement", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- SimpleName name = methodDeclaration.getName();
- checkSourceRange(name, "mdd", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21768
- */
- public void test0359() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0359", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0,0);
- assertNotNull(node);
- assertTrue("Not a method declaration statement", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- SimpleName name = methodDeclaration.getName();
- checkSourceRange(name, "mdd", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916
- */
- public void test0360() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0360", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0,0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- List initializers = forStatement.initializers();
- assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916
- */
- public void test0361() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0361", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0,0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- List initializers = forStatement.initializers();
- assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916
- */
- public void test0362() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0362", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
-
- VariableDeclarationFragment iFragment = this.ast.newVariableDeclarationFragment();
- iFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- iFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- VariableDeclarationFragment jFragment = this.ast.newVariableDeclarationFragment();
- jFragment.setName(this.ast.newSimpleName("j")); //$NON-NLS-1$
- jFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- VariableDeclarationFragment kFragment = this.ast.newVariableDeclarationFragment();
- kFragment.setName(this.ast.newSimpleName("k")); //$NON-NLS-1$
- kFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
-
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(iFragment);
- variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- variableDeclarationExpression.fragments().add(jFragment);
- variableDeclarationExpression.fragments().add(kFragment);
- forStatement.initializers().add(variableDeclarationExpression);
-
- PostfixExpression iPostfixExpression = this.ast.newPostfixExpression();
- iPostfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- iPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(iPostfixExpression);
-
- PostfixExpression jPostfixExpression = this.ast.newPostfixExpression();
- jPostfixExpression.setOperand(this.ast.newSimpleName("j"));//$NON-NLS-1$
- jPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(jPostfixExpression);
-
- PostfixExpression kPostfixExpression = this.ast.newPostfixExpression();
- kPostfixExpression.setOperand(this.ast.newSimpleName("k"));//$NON-NLS-1$
- kPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(kPostfixExpression);
-
- forStatement.setBody(this.ast.newBlock());
-
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$
- forStatement.setExpression(infixExpression);
-
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (int i=0, j=0, k=0; i<10 ; i++, j++, k++) {}", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22939
- */
- public void test0363() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0363", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a parenthesized expression", expression.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$
- Expression expression2 = ((ParenthesizedExpression) expression).getExpression();
- checkSourceRange(expression2, "xxxx", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11529
- */
- public void test0364() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0364", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- checkSourceRange(variableDeclarationStatement, "int local;", source); //$NON-NLS-1$
- SimpleName simpleName = variableDeclarationFragment.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11529
- */
- public void test0365() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0365", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- List initializers = forStatement.initializers();
- assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$
- VariableDeclarationExpression variableDeclarationExpression = (VariableDeclarationExpression) initializers.get(0);
- List fragments = variableDeclarationExpression.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- SimpleName simpleName = variableDeclarationFragment.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0366() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0366", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- checkSourceRange(forStatement, "for (int i = 0; i < 5; ++i);", source); //$NON-NLS-1$
- Statement statement = forStatement.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0367() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0367", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a while statement", node.getNodeType() == ASTNode.WHILE_STATEMENT); //$NON-NLS-1$
- WhileStatement whileStatement = (WhileStatement) node;
- checkSourceRange(whileStatement, "while(i == 2);", source); //$NON-NLS-1$
- Statement statement = whileStatement.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0368() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0368", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 1, "The label test is never explicitly referenced"); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.LABELED_STATEMENT); //$NON-NLS-1$
- LabeledStatement labeledStatement = (LabeledStatement) node;
- checkSourceRange(labeledStatement, "test:;", source); //$NON-NLS-1$
- Statement statement = labeledStatement.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0369() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0369", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 1, "The label test is never explicitly referenced"); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.LABELED_STATEMENT); //$NON-NLS-1$
- LabeledStatement labeledStatement = (LabeledStatement) node;
- checkSourceRange(labeledStatement, "test:\\u003B", source); //$NON-NLS-1$
- Statement statement = labeledStatement.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, "\\u003B", source); //$NON-NLS-1$
- }
-
- /**
- * DoStatement ==> DoStatement
- */
- public void test0370() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0370", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- DoStatement doStatement = this.ast.newDoStatement();
- doStatement.setBody(this.ast.newEmptyStatement());
- doStatement.setExpression(this.ast.newBooleanLiteral(true));
- assertTrue("Both AST trees should be identical", doStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "do ; while(true);";//$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- DoStatement doStatement2 = (DoStatement) node;
- Statement statement = doStatement2.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0371() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0371", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node;
- checkSourceRange(ifStatement, "if (i == 6);", source); //$NON-NLS-1$
- Statement statement = ifStatement.getThenStatement();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0372() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0372", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node;
- checkSourceRange(ifStatement, "if (i == 6) {} else ;", source); //$NON-NLS-1$
- Statement statement = ifStatement.getElseStatement();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23118
- */
- public void test0373() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0373", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- Statement statement = forStatement.getBody();
- assertTrue("Not a block statement", statement.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$
- Block block = (Block) statement;
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement2 = (Statement) statements.get(0);
- assertTrue("Not a break statement", statement2.getNodeType() == ASTNode.BREAK_STATEMENT); //$NON-NLS-1$
- BreakStatement breakStatement = (BreakStatement) statement2;
- checkSourceRange(breakStatement, "break;", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23118
- */
- public void test0374() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0374", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- Statement statement = forStatement.getBody();
- assertTrue("Not a block statement", statement.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$
- Block block = (Block) statement;
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement2 = (Statement) statements.get(0);
- assertTrue("Not a break statement", statement2.getNodeType() == ASTNode.CONTINUE_STATEMENT); //$NON-NLS-1$
- ContinueStatement continueStatement = (ContinueStatement) statement2;
- checkSourceRange(continueStatement, "continue;", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23052
- */
- public void test0375() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0375", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("problems found", 1, compilationUnit.getMessages().length); //$NON-NLS-1$
- List imports = compilationUnit.imports();
- assertEquals("wrong size", 1, imports.size()); //$NON-NLS-1$
- ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0);
- IBinding binding = importDeclaration.resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("Not a type binding", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22939
- */
- public void test0376() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0376", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23050
- */
- public void test0377() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0377", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = variableDeclarationFragment.resolveBinding();
- assertNotNull("No variable binding", variableBinding); //$NON-NLS-1$
- assertEquals("Wrong modifier", IModifierConstants.ACC_FINAL, variableBinding.getModifiers()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22161
- */
- public void test0378() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0378", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- SimpleName name = typeDeclaration.getName();
- checkSourceRange(name, "B", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22161
- */
- public void test0379() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0379", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation2 = (ClassInstanceCreation) expression;
- Type type = classInstanceCreation2.getType();
- checkSourceRange(type, "Object", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22054
- */
- public void test0380() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0380", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not a super method invocation", expression.getNodeType() == ASTNode.SUPER_METHOD_INVOCATION); //$NON-NLS-1$
- SuperMethodInvocation superMethodInvocation = (SuperMethodInvocation) expression;
- ITypeBinding typeBinding = superMethodInvocation.resolveTypeBinding();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong declaring class", typeBinding.getSuperclass().getName(), "Object"); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName = superMethodInvocation.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.METHOD, binding.getKind()); //$NON-NLS-1$
- IFunctionBinding methodBinding = (IFunctionBinding) binding;
- assertEquals("Wrong declaring class", methodBinding.getDeclaringClass().getName(), "Object"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23054
- */
- public void test0381() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0381", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- JSdoc javadoc = typeDeclaration.getJavadoc();
- assertNull("Javadoc not null", javadoc); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0382() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0382", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong fully qualified name", typeBinding.getQualifiedName(), "test0382.A"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0383() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0383", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong fully qualified name", typeBinding.getQualifiedName(), "test0383.A.B"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0384() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0384", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong fully qualified name", typeBinding.getQualifiedName(), "test0384.A.B.D"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23117
- */
- public void test0385() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0385", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 1, compilationUnit.getMessages().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23259
- */
- public void test0386() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0386", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a switch statement", node.getNodeType() == ASTNode.SWITCH_STATEMENT); //$NON-NLS-1$
- SwitchStatement switchStatement = (SwitchStatement) node;
- List statements = switchStatement.statements();
- assertEquals("Wrong size", 5, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not a case statement", statement.getNodeType() == ASTNode.SWITCH_CASE); //$NON-NLS-1$
- checkSourceRange(statement, "case 1:", source); //$NON-NLS-1$
- statement = (Statement) statements.get(3);
- assertTrue("Not a default case statement", statement.getNodeType() == ASTNode.SWITCH_CASE); //$NON-NLS-1$
- checkSourceRange(statement, "default :", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22939
- */
- public void test0387() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0387", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0388() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0388", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "test0388.A", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0389() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0389", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "test0389.A.B", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0390() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0390", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Type type = methodDeclaration.getReturnType2();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "int", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0391() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0391", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Type type = methodDeclaration.getReturnType2();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "int[]", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22154
- */
- public void test0392() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0392", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Type type = methodDeclaration.getReturnType2();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "java.lang.String[]", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284
- */
- public void test0393() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0393", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Type type = methodDeclaration.getReturnType2();
- checkSourceRange(type, "String", source); //$NON-NLS-1$
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "java.lang.String", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong dimension", 1, methodDeclaration.getExtraDimensions()); //$NON-NLS-1$
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertNotNull("No method binding", methodBinding); //$NON-NLS-1$
- ITypeBinding typeBinding2 = methodBinding.getReturnType();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "java.lang.String[]", typeBinding2.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong dimension", 1, typeBinding2.getDimensions()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284
- */
- public void test0394() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0394", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Type type = methodDeclaration.getReturnType2();
- checkSourceRange(type, "String", source); //$NON-NLS-1$
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "java.lang.String", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong dimension", 0, methodDeclaration.getExtraDimensions()); //$NON-NLS-1$
- }
-
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284
- */
- public void test0395() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0395", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Type type = methodDeclaration.getReturnType2();
- checkSourceRange(type, "String[]", source); //$NON-NLS-1$
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong dimension", 1, typeBinding.getDimensions()); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "java.lang.String[]", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong dimension", 1, methodDeclaration.getExtraDimensions()); //$NON-NLS-1$
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertNotNull("No method binding", methodBinding); //$NON-NLS-1$
- ITypeBinding typeBinding2 = methodBinding.getReturnType();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong qualified name", "java.lang.String[][]", typeBinding2.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong dimension", 2, typeBinding2.getDimensions()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284
- */
- public void test0396() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0396", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration method = (FunctionDeclaration) node;
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) method.parameters().get(0);
- assertNotNull("Expression should not be null", singleVariableDeclaration); //$NON-NLS-1$
- checkSourceRange(singleVariableDeclaration, "final String s[]", source); //$NON-NLS-1$
- Type type = singleVariableDeclaration.getType();
- checkSourceRange(type, "String", source); //$NON-NLS-1$
- assertEquals("Wrong dimension", 1, singleVariableDeclaration.getExtraDimensions()); //$NON-NLS-1$
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("An array binding", !typeBinding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
- assertEquals("wrong fully qualified name", "java.lang.String", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- IVariableBinding variableBinding = singleVariableDeclaration.resolveBinding();
- assertNotNull("No variable binding", variableBinding); //$NON-NLS-1$
- assertTrue("Is a parameter", variableBinding.isParameter());
- ITypeBinding typeBinding2 = variableBinding.getType();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- assertTrue("Not an array binding", typeBinding2.isArray()); //$NON-NLS-1$
- assertEquals("Wrong dimension", 1, typeBinding2.getDimensions()); //$NON-NLS-1$
- assertEquals("wrong fully qualified name", "java.lang.String[]", typeBinding2.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23284
- */
- public void test0397() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0397", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration method = (FunctionDeclaration) node;
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) method.parameters().get(0);
- assertNotNull("Expression should not be null", singleVariableDeclaration); //$NON-NLS-1$
- checkSourceRange(singleVariableDeclaration, "final String[] \\u0073\\u005B][]", source); //$NON-NLS-1$
- Type type = singleVariableDeclaration.getType();
- checkSourceRange(type, "String[]", source); //$NON-NLS-1$
- assertEquals("Wrong dimension", 2, singleVariableDeclaration.getExtraDimensions()); //$NON-NLS-1$
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not an array binding", typeBinding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong dimension", 1, typeBinding.getDimensions()); //$NON-NLS-1$
- assertEquals("wrong fully qualified name", "java.lang.String[]", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- IVariableBinding variableBinding = singleVariableDeclaration.resolveBinding();
- assertNotNull("No variable binding", variableBinding); //$NON-NLS-1$
- assertTrue("Is a parameter", variableBinding.isParameter());
- ITypeBinding typeBinding2 = variableBinding.getType();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- assertTrue("Not an array binding", typeBinding2.isArray()); //$NON-NLS-1$
- assertEquals("Wrong dimension", 3, typeBinding2.getDimensions()); //$NON-NLS-1$
- assertEquals("wrong fully qualified name", "java.lang.String[][][]", typeBinding2.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23362
- */
- public void test0398() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0398", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an infix expression", expression.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "(1 + 2) * 3", source); //$NON-NLS-1$
- Expression expression2 = infixExpression.getLeftOperand();
- assertTrue("Not an parenthesis expression", expression2.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2;
- Expression expression3 = parenthesizedExpression.getExpression();
- assertTrue("Not an infix expression", expression3.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- checkSourceRange(expression3, "1 + 2", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22306
- */
- public void test0399() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0399", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Not a constructor", methodDeclaration.isConstructor()); //$NON-NLS-1$
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 2, statements.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22306
- */
- public void test0400() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0400", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Not a constructor", methodDeclaration.isConstructor()); //$NON-NLS-1$
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 3, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not an superconstructorinvocation", statement.getNodeType() == ASTNode.SUPER_CONSTRUCTOR_INVOCATION); //$NON-NLS-1$
- checkSourceRange(statement, "super();", source); //$NON-NLS-1$
- }
-}
-
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterBindingsTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterBindingsTest.java
deleted file mode 100644
index efa3e8f..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterBindingsTest.java
+++ /dev/null
@@ -1,506 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.IJavaScriptProject;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.IPackageFragment;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.ASTVisitor;
-import org.eclipse.wst.jsdt.core.dom.AbstractTypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ArrayAccess;
-import org.eclipse.wst.jsdt.core.dom.ArrayCreation;
-import org.eclipse.wst.jsdt.core.dom.ArrayInitializer;
-import org.eclipse.wst.jsdt.core.dom.ArrayType;
-import org.eclipse.wst.jsdt.core.dom.Assignment;
-import org.eclipse.wst.jsdt.core.dom.BooleanLiteral;
-import org.eclipse.wst.jsdt.core.dom.CharacterLiteral;
-import org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation;
-import org.eclipse.wst.jsdt.core.dom.ConditionalExpression;
-import org.eclipse.wst.jsdt.core.dom.ConstructorInvocation;
-import org.eclipse.wst.jsdt.core.dom.FieldAccess;
-import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
-import org.eclipse.wst.jsdt.core.dom.FunctionRef;
-import org.eclipse.wst.jsdt.core.dom.IBinding;
-import org.eclipse.wst.jsdt.core.dom.IFunctionBinding;
-import org.eclipse.wst.jsdt.core.dom.IPackageBinding;
-import org.eclipse.wst.jsdt.core.dom.ITypeBinding;
-import org.eclipse.wst.jsdt.core.dom.IVariableBinding;
-import org.eclipse.wst.jsdt.core.dom.ImportDeclaration;
-import org.eclipse.wst.jsdt.core.dom.InfixExpression;
-import org.eclipse.wst.jsdt.core.dom.InstanceofExpression;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.ListExpression;
-import org.eclipse.wst.jsdt.core.dom.MemberRef;
-import org.eclipse.wst.jsdt.core.dom.NullLiteral;
-import org.eclipse.wst.jsdt.core.dom.NumberLiteral;
-import org.eclipse.wst.jsdt.core.dom.PackageDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ParenthesizedExpression;
-import org.eclipse.wst.jsdt.core.dom.PostfixExpression;
-import org.eclipse.wst.jsdt.core.dom.PrefixExpression;
-import org.eclipse.wst.jsdt.core.dom.PrimitiveType;
-import org.eclipse.wst.jsdt.core.dom.QualifiedName;
-import org.eclipse.wst.jsdt.core.dom.SimpleName;
-import org.eclipse.wst.jsdt.core.dom.SimpleType;
-import org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.wst.jsdt.core.dom.StringLiteral;
-import org.eclipse.wst.jsdt.core.dom.SuperConstructorInvocation;
-import org.eclipse.wst.jsdt.core.dom.SuperFieldAccess;
-import org.eclipse.wst.jsdt.core.dom.SuperMethodInvocation;
-import org.eclipse.wst.jsdt.core.dom.ThisExpression;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.TypeLiteral;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment;
-
-public class ASTConverterBindingsTest extends ConverterTestSetup {
- private static final boolean DEBUG = false;
-
- static class BindingsCollector extends ASTVisitor {
-
- public ArrayList arrayList;
-
- BindingsCollector() {
- // visit Javadoc.tags() as well
- super(true);
- this.arrayList = new ArrayList();
- }
-
- private void collectBindings(
- ASTNode node,
- IBinding binding) {
-
- if (binding != null) {
- arrayList.add(binding);
- }
- }
-
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(AnonymousClassDeclaration)
- */
- public void endVisit(AnonymousClassDeclaration node) {
- ITypeBinding typeBinding = node.resolveBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ArrayAccess)
- */
- public void endVisit(ArrayAccess node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ArrayCreation)
- */
- public void endVisit(ArrayCreation node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ArrayInitializer)
- */
- public void endVisit(ArrayInitializer node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ArrayType)
- */
- public void endVisit(ArrayType node) {
- ITypeBinding typeBinding = node.resolveBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(Assignment)
- */
- public void endVisit(Assignment node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(BooleanLiteral)
- */
- public void endVisit(BooleanLiteral node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(CharacterLiteral)
- */
- public void endVisit(CharacterLiteral node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ClassInstanceCreation)
- */
- public void endVisit(ClassInstanceCreation node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ConditionalExpression)
- */
- public void endVisit(ConditionalExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ConstructorInvocation)
- */
- public void endVisit(ConstructorInvocation node) {
- IFunctionBinding methodBinding = node.resolveConstructorBinding();
- collectBindings(node, methodBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(FieldAccess)
- */
- public void endVisit(FieldAccess node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ImportDeclaration)
- */
- public void endVisit(ImportDeclaration node) {
- IBinding binding = node.resolveBinding();
- collectBindings(node, binding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(InfixExpression)
- */
- public void endVisit(InfixExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(InstanceofExpression)
- */
- public void endVisit(InstanceofExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- public void endVisit(ListExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see ASTVisitor#endVisit(MemberRef)
- * @since 3.0
- */
- public void endVisit(MemberRef node) {
- IBinding binding = node.resolveBinding();
- collectBindings(node, binding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(FunctionDeclaration)
- */
- public void endVisit(FunctionDeclaration node) {
- IFunctionBinding methodBinding = node.resolveBinding();
- collectBindings(node, methodBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(FunctionInvocation)
- */
- public void endVisit(FunctionInvocation node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see ASTVisitor#endVisit(FunctionRef )
- * @since 3.0
- */
- public void endVisit(FunctionRef node) {
- IBinding binding = node.resolveBinding();
- collectBindings(node, binding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(NullLiteral)
- */
- public void endVisit(NullLiteral node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(NumberLiteral)
- */
- public void endVisit(NumberLiteral node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(PackageDeclaration)
- */
- public void endVisit(PackageDeclaration node) {
- IPackageBinding packageBinding = node.resolveBinding();
- collectBindings(node, packageBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ParenthesizedExpression)
- */
- public void endVisit(ParenthesizedExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(PostfixExpression)
- */
- public void endVisit(PostfixExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(PrefixExpression)
- */
- public void endVisit(PrefixExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(PrimitiveType)
- */
- public void endVisit(PrimitiveType node) {
- ITypeBinding typeBinding = node.resolveBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(QualifiedName)
- */
- public void endVisit(QualifiedName node) {
- IBinding binding = node.resolveBinding();
- collectBindings(node, binding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SimpleName)
- */
- public void endVisit(SimpleName node) {
- IBinding binding = node.resolveBinding();
- collectBindings(node, binding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SimpleType)
- */
- public void endVisit(SimpleType node) {
- ITypeBinding typeBinding = node.resolveBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SingleVariableDeclaration)
- */
- public void endVisit(SingleVariableDeclaration node) {
- IVariableBinding variableBinding = node.resolveBinding();
- collectBindings(node, variableBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(StringLiteral)
- */
- public void endVisit(StringLiteral node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SuperConstructorInvocation)
- */
- public void endVisit(SuperConstructorInvocation node) {
- IFunctionBinding methodBinding = node.resolveConstructorBinding();
- collectBindings(node, methodBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SuperFieldAccess)
- */
- public void endVisit(SuperFieldAccess node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(SuperMethodInvocation)
- */
- public void endVisit(SuperMethodInvocation node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(ThisExpression)
- */
- public void endVisit(ThisExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(TypeDeclaration)
- */
- public void endVisit(TypeDeclaration node) {
- ITypeBinding typeBinding = node.resolveBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(TypeLiteral)
- */
- public void endVisit(TypeLiteral node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(VariableDeclarationExpression)
- */
- public void endVisit(VariableDeclarationExpression node) {
- ITypeBinding typeBinding = node.resolveTypeBinding();
- collectBindings(node, typeBinding);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(VariableDeclarationFragment)
- */
- public void endVisit(VariableDeclarationFragment node) {
- IVariableBinding variableBinding = node.resolveBinding();
- collectBindings(node, variableBinding);
- }
-
- public List getBindings() {
- return arrayList;
- }
-
- }
-
-
- public void setUpSuite() throws Exception {
- super.setUpSuite();
- this.ast = AST.newAST(AST.JLS3);
- }
-
- public ASTConverterBindingsTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- return buildModelTestSuite(ASTConverterBindingsTest.class);
- }
-
- public void test0001() throws JavaScriptModelException {
- checkBindingEqualityForProject("Converter");
- checkBindingEqualityForProject("Converter15");
- }
-
- /**
- * @throws JavaScriptModelException
- */
- private void checkBindingEqualityForProject(String projectName) throws JavaScriptModelException {
- IJavaScriptProject javaProject = getJavaProject(projectName);
- IPackageFragment[] packageFragments = javaProject.getPackageFragments();
- ArrayList compilationUnitscollector = new ArrayList();
- for (int j = 0, max2 = packageFragments.length; j < max2; j++) {
- IJavaScriptUnit[] units = packageFragments[j].getJavaScriptUnits();
- if (units != null) {
- for (int k = 0, max3 = units.length; k < max3; k++) {
- compilationUnitscollector.add(units[k]);
- }
- }
- }
- final int length = compilationUnitscollector.size();
- IJavaScriptUnit[] units = new IJavaScriptUnit[length];
- compilationUnitscollector.toArray(units);
- long totalTime = 0;
- for (int j = 0; j < length; j++) {
- IJavaScriptUnit currentUnit = units[j];
- ASTNode result = runConversion(AST.JLS3, currentUnit, true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) result;
- result = runConversion(AST.JLS3, currentUnit, true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType());
- if (DEBUG) {
- if (unit.types().size() > 0 ) {
- AbstractTypeDeclaration typeDeclaration = (AbstractTypeDeclaration) unit.types().get(0);
- StringBuffer buffer = new StringBuffer();
- PackageDeclaration packageDeclaration = unit.getPackage();
- if (packageDeclaration != null) {
- buffer.append(unit.getPackage().getName()).append(".").append(typeDeclaration.getName());
- } else {
- buffer.append(typeDeclaration.getName());
- }
- System.out.println(String.valueOf(buffer));
- } else {
- System.out.println(currentUnit.getElementName());
- }
- }
- JavaScriptUnit unit2 = (JavaScriptUnit) result;
- BindingsCollector collector = new BindingsCollector();
- unit.accept(collector);
- List bindings1 = collector.getBindings();
- BindingsCollector collector2 = new BindingsCollector();
- unit2.accept(collector2);
- List bindings2 = collector2.getBindings();
- assertEquals("Wrong size", bindings1.size(), bindings2.size());
- long time = System.currentTimeMillis();
- for (int i = 0, max = bindings1.size(); i < max; i++) {
- final Object object = bindings1.get(i);
- assertTrue("not a binding", object instanceof IBinding);
- final IBinding binding = (IBinding) object;
- final Object object2 = bindings2.get(i);
- assertTrue("not a binding", object2 instanceof IBinding);
- final IBinding binding2 = (IBinding) object2;
- final boolean equalTo = binding.isEqualTo(binding2);
- assertTrue("not equals", equalTo);
- }
- totalTime += (System.currentTimeMillis() - time);
- }
- if (DEBUG) {
- System.out.println("Total time = " + totalTime + "ms");
- }
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterJavadocTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterJavadocTest.java
deleted file mode 100644
index c7900f6..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterJavadocTest.java
+++ /dev/null
@@ -1,3405 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.jsdt.core.IJavaScriptProject;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.compiler.IProblem;
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.ASTParser;
-import org.eclipse.wst.jsdt.core.dom.ArrayType;
-import org.eclipse.wst.jsdt.core.dom.Block;
-import org.eclipse.wst.jsdt.core.dom.Comment;
-import org.eclipse.wst.jsdt.core.dom.Expression;
-import org.eclipse.wst.jsdt.core.dom.ExpressionStatement;
-import org.eclipse.wst.jsdt.core.dom.FieldDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
-import org.eclipse.wst.jsdt.core.dom.FunctionRef;
-import org.eclipse.wst.jsdt.core.dom.FunctionRefParameter;
-import org.eclipse.wst.jsdt.core.dom.IBinding;
-import org.eclipse.wst.jsdt.core.dom.ITypeBinding;
-import org.eclipse.wst.jsdt.core.dom.IfStatement;
-import org.eclipse.wst.jsdt.core.dom.JSdoc;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.MemberRef;
-import org.eclipse.wst.jsdt.core.dom.Name;
-import org.eclipse.wst.jsdt.core.dom.PackageDeclaration;
-import org.eclipse.wst.jsdt.core.dom.PrimitiveType;
-import org.eclipse.wst.jsdt.core.dom.QualifiedName;
-import org.eclipse.wst.jsdt.core.dom.ReturnStatement;
-import org.eclipse.wst.jsdt.core.dom.SimpleName;
-import org.eclipse.wst.jsdt.core.dom.SimpleType;
-import org.eclipse.wst.jsdt.core.dom.Statement;
-import org.eclipse.wst.jsdt.core.dom.TagElement;
-import org.eclipse.wst.jsdt.core.dom.TextElement;
-import org.eclipse.wst.jsdt.core.dom.Type;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement;
-import org.eclipse.wst.jsdt.internal.compiler.parser.ScannerHelper;
-
-public class ASTConverterJavadocTest extends ConverterTestSetup {
-
- // Flag to know whether Converter directory should be copied from org.eclipse.wst.jsdt.core.tests.model project
- static protected boolean COPY_DIR = true;
-
- // Test counters
- protected static int[] TEST_COUNTERS = { 0, 0, 0, 0 };
- // Unicode tests
- protected static boolean UNICODE = false;
- // Unix tests
- final boolean unix;
- static final String UNIX_SUPPORT = System.getProperty("unix");
- // Doc Comment support
- static final String DOC_COMMENT_SUPPORT = System.getProperty("doc.support");
- final String docCommentSupport;
-
- // List of comments read from source of test
- private final int LINE_COMMENT = 100;
- private final int BLOCK_COMMENT =200;
- private final int DOC_COMMENT = 300;
- List comments = new ArrayList();
- private String chars;
- // List of tags contained in each comment read from test source.
- List allTags = new ArrayList();
- // Current compilation unit
- protected IJavaScriptUnit sourceUnit;
- // Test package binding
- protected boolean resolveBinding = true;
- protected boolean packageBinding = true;
- // AST Level
- /** @deprecated using deprecated code */
- protected int astLevel = AST.JLS2;
- protected int savedLevel;
- // Debug
- protected String prefix = "";
- protected boolean debug = false;
- protected StringBuffer problems;
- protected String compilerOption = JavaScriptCore.IGNORE;
- protected List failures;
- protected boolean stopOnFailure = true;
- // Project
- protected IJavaScriptProject currentProject;
- Map savedOptions = null;
-
- /**
- * @param name
- * @param support
- */
- public ASTConverterJavadocTest(String name, String support, String unix) {
- super(name);
- this.docCommentSupport = support;
- this.unix = "true".equals(unix);
- }
- /**
- * @param name
- */
- public ASTConverterJavadocTest(String name) {
- this(name, JavaScriptCore.ENABLED, UNIX_SUPPORT);
- }
-
- public static Test suite() {
- TestSuite suite = new Suite(ASTConverterJavadocTest.class.getName());
-// String param = System.getProperty("unicode");
-// if ("true".equals(param)) {
-// unicode = true;
-// }
-// String param = System.getProperty("unix");
-// if ("true".equals(param)) {
-// unix = true;
-// }
- if (true) {
- if (DOC_COMMENT_SUPPORT == null) {
- buildSuite(suite, JavaScriptCore.ENABLED);
- buildSuite(suite, JavaScriptCore.DISABLED);
- } else {
- String support = DOC_COMMENT_SUPPORT==null ? JavaScriptCore.DISABLED : (DOC_COMMENT_SUPPORT.equals(JavaScriptCore.DISABLED)?JavaScriptCore.DISABLED:JavaScriptCore.ENABLED);
- buildSuite(suite, support);
- }
- return suite;
- }
-
- // Run test cases subset
- COPY_DIR = false;
- System.err.println("WARNING: only subset of tests will be executed!!!");
- suite.addTest(new ASTConverterJavadocTest("testBug165525"));
- return suite;
- }
-
- public static void buildSuite(TestSuite suite, String support) {
- Class c = ASTConverterJavadocTest.class;
- Method[] methods = c.getMethods();
- for (int i = 0, max = methods.length; i < max; i++) {
- if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
- suite.addTest(new ASTConverterJavadocTest(methods[i].getName(), support, UNIX_SUPPORT));
- }
- }
- // when unix support not specified, also run using unix format
- if (UNIX_SUPPORT == null && JavaScriptCore.ENABLED.equals(support)) {
- for (int i = 0, max = methods.length; i < max; i++) {
- if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
- suite.addTest(new ASTConverterJavadocTest(methods[i].getName(), support, "true"));
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.tests.model.AbstractJavaModelTests#copyDirectory(java.io.File, java.io.File)
- */
- protected void copyDirectory(File sourceDir, File targetDir) throws IOException {
- if (COPY_DIR) {
- super.copyDirectory(sourceDir, targetDir);
- } else {
- targetDir.mkdirs();
- File sourceFile = new File(sourceDir, ".project");
- File targetFile = new File(targetDir, ".project");
- targetFile.createNewFile();
- copy(sourceFile, targetFile);
- sourceFile = new File(sourceDir, ".classpath");
- targetFile = new File(targetDir, ".classpath");
- targetFile.createNewFile();
- copy(sourceFile, targetFile);
- }
- }
- /* (non-Javadoc)
- * @see junit.framework.TestCase#getName()
- */
- public String getName() {
- String strUnix = unix ? " - Unix" : "";
- return "Doc "+docCommentSupport+strUnix+" - "+super.getName();
- }
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void setUp() throws Exception {
- super.setUp();
- TEST_COUNTERS[0]++;
- failures = new ArrayList();
- problems = new StringBuffer();
- workingCopies = null;
- savedLevel = astLevel;
- }
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- protected void tearDown() throws Exception {
- int size = failures.size();
- String title = size+" positions/bindings were incorrect in "+getName();
- if (size == 0) {
- TEST_COUNTERS[1]++;
- } else if (problems.length() > 0) {
- if (debug) {
- System.out.println("Compilation warnings/errors occured:");
- System.out.println(problems.toString());
- }
- TEST_COUNTERS[2]++;
- } else {
- TEST_COUNTERS[3]++;
- System.out.println(title+":");
- for (int i=0; i<size; i++) {
- System.out.println(" - "+failures.get(i));
- }
- }
-// if (!stopOnFailure) {
- assertTrue(title, size==0 || problems.length() > 0);
-// }
- super.tearDown();
-
- // Restore saved ast level
- astLevel = savedLevel;
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#tearDown()
- */
- public void tearDownSuite() throws Exception {
- // put default options on project
- if (currentProject != null && savedOptions != null) {
- currentProject.setOptions(savedOptions);
- }
- super.tearDownSuite();
- if (TEST_COUNTERS[0] != TEST_COUNTERS[1]) {
- NumberFormat intFormat = NumberFormat.getInstance();
- intFormat.setMinimumIntegerDigits(3);
- intFormat.setMaximumIntegerDigits(3);
- System.out.println("=====================================");
- System.out.println(intFormat.format(TEST_COUNTERS[0])+" tests have been executed:");
- System.out.println(" - "+intFormat.format(TEST_COUNTERS[1])+" tests have been actually executed.");
- System.out.println(" - "+intFormat.format(TEST_COUNTERS[2])+" tests were skipped due to compilation errors.");
- System.out.println(" - "+intFormat.format(TEST_COUNTERS[3])+" tests failed.");
- }
- }
-
- public ASTNode runConversion(char[] source, String unitName, IJavaScriptProject project) {
- ASTParser parser = ASTParser.newParser(astLevel);
- parser.setSource(source);
- parser.setUnitName(unitName);
- parser.setProject(project);
- parser.setResolveBindings(resolveBinding);
- return parser.createAST(null);
- }
-
- public ASTNode runConversion(char[] source, String unitName, IJavaScriptProject project, Map options) {
- if (project == null) {
- ASTParser parser = ASTParser.newParser(astLevel);
- parser.setSource(source);
- parser.setUnitName(unitName);
- parser.setCompilerOptions(options);
- parser.setResolveBindings(resolveBinding);
- return parser.createAST(null);
- }
- return runConversion(source, unitName, project);
- }
-
-// NOT USED
-// class ASTConverterJavadocFlattener extends ASTVisitor {
-//
-// /**
-// * The string buffer into which the serialized representation of the AST is
-// * written.
-// */
-// private StringBuffer buffer;
-//
-// private String comment;
-//
-// /**
-// * Creates a new AST printer.
-// */
-// ASTConverterJavadocFlattener(String comment) {
-// buffer = new StringBuffer();
-// comment = comment;
-// }
-//
-// /**
-// * Returns the string accumulated in the visit.
-// *
-// * @return the serialized
-// */
-// public String getResult() {
-// return buffer.toString();
-// }
-//
-// /**
-// * Resets this printer so that it can be used again.
-// */
-// public void reset() {
-// buffer.setLength(0);
-// }
-//
-// /*
-// * @see ASTVisitor#visit(ArrayType)
-// */
-// public boolean visit(ArrayType node) {
-// node.getComponentType().accept(this);
-// buffer.append("[]");//$NON-NLS-1$
-// return false;
-// }
-//
-// /*
-// * @see ASTVisitor#visit(BlockComment)
-// * @since 3.0
-// */
-// public boolean visit(BlockComment node) {
-// buffer.append(comment);
-// return false;
-// }
-//
-// /*
-// * @see ASTVisitor#visit(Javadoc)
-// */
-// public boolean visit(Javadoc node) {
-//
-// // ignore deprecated node.getComment()
-// buffer.append("/**");//$NON-NLS-1$
-// ASTNode e = null;
-// int start = 3;
-// for (Iterator it = node.tags().iterator(); it.hasNext(); ) {
-// e = (ASTNode) it.next();
-// try {
-// buffer.append(comment.substring(start, e.getStartPosition()-node.getStartPosition()));
-// start = e.getStartPosition()-node.getStartPosition();
-// } catch (IndexOutOfBoundsException ex) {
-// // do nothing
-// }
-// e.accept(this);
-// start += e.getLength();
-// }
-// buffer.append(comment.substring(start, node.getLength()));
-// return false;
-// }
-//
-// /*
-// * @see ASTVisitor#visit(LineComment)
-// * @since 3.0
-// */
-// public boolean visit(LineComment node) {
-// buffer.append(comment);
-// return false;
-// }
-//
-// /*
-// * @see ASTVisitor#visit(MemberRef)
-// * @since 3.0
-// */
-// public boolean visit(MemberRef node) {
-// if (node.getQualifier() != null) {
-// node.getQualifier().accept(this);
-// }
-// buffer.append("#");//$NON-NLS-1$
-// node.getName().accept(this);
-// return true;
-// }
-//
-// /*
-// * @see ASTVisitor#visit(FunctionRef)
-// * @since 3.0
-// */
-// public boolean visit(FunctionRef node) {
-// if (node.getQualifier() != null) {
-// node.getQualifier().accept(this);
-// }
-// buffer.append("#");//$NON-NLS-1$
-// node.getName().accept(this);
-// buffer.append("(");//$NON-NLS-1$
-// for (Iterator it = node.parameters().iterator(); it.hasNext(); ) {
-// FunctionRefParameter e = (FunctionRefParameter) it.next();
-// e.accept(this);
-// if (it.hasNext()) {
-// buffer.append(",");//$NON-NLS-1$
-// }
-// }
-// buffer.append(")");//$NON-NLS-1$
-// return true;
-// }
-//
-// /*
-// * @see ASTVisitor#visit(FunctionRefParameter)
-// * @since 3.0
-// */
-// public boolean visit(FunctionRefParameter node) {
-// node.getType().accept(this);
-// if (node.getName() != null) {
-// buffer.append(" ");//$NON-NLS-1$
-// node.getName().accept(this);
-// }
-// return true;
-// }
-//
-// /*
-// * @see ASTVisitor#visit(TagElement)
-// * @since 3.0
-// */
-// public boolean visit(TagElement node) {
-// Javadoc javadoc = null;
-// int start = 0;
-// if (node.isNested()) {
-// // nested tags are always enclosed in braces
-// buffer.append("{");//$NON-NLS-1$
-// javadoc = (Javadoc) node.getParent().getParent();
-// start++;
-// } else {
-// javadoc = (Javadoc) node.getParent();
-// }
-// start += node.getStartPosition()-javadoc.getStartPosition();
-// if (node.getTagName() != null) {
-// buffer.append(node.getTagName());
-// start += node.getTagName().length();
-// }
-// for (Iterator it = node.fragments().iterator(); it.hasNext(); ) {
-// ASTNode e = (ASTNode) it.next();
-// try {
-// buffer.append(comment.substring(start, e.getStartPosition()-javadoc.getStartPosition()));
-// start = e.getStartPosition()-javadoc.getStartPosition();
-// } catch (IndexOutOfBoundsException ex) {
-// // do nothing
-// }
-// start += e.getLength();
-// e.accept(this);
-// }
-// if (node.isNested()) {
-// buffer.append("}");//$NON-NLS-1$
-// }
-// return true;
-// }
-//
-// /*
-// * @see ASTVisitor#visit(TextElement)
-// * @since 3.0
-// */
-// public boolean visit(TextElement node) {
-// buffer.append(node.getText());
-// return false;
-// }
-//
-// /*
-// * @see ASTVisitor#visit(PrimitiveType)
-// */
-// public boolean visit(PrimitiveType node) {
-// buffer.append(node.getPrimitiveTypeCode().toString());
-// return false;
-// }
-//
-// /*
-// * @see ASTVisitor#visit(QualifiedName)
-// */
-// public boolean visit(QualifiedName node) {
-// node.getQualifier().accept(this);
-// buffer.append(".");//$NON-NLS-1$
-// node.getName().accept(this);
-// return false;
-// }
-//
-// /*
-// * @see ASTVisitor#visit(SimpleName)
-// */
-// public boolean visit(SimpleName node) {
-// buffer.append(node.getIdentifier());
-// return false;
-// }
-//
-// /*
-// * @see ASTVisitor#visit(SimpleName)
-// */
-// public boolean visit(SimpleType node) {
-// node.getName().accept(this);
-// return false;
-// }
-// }
-
- private char getNextChar(char[] source, int idx) {
- // get next char
- char ch = source[idx];
- int charLength = 1;
- int pos = idx;
- chars = null;
- if (ch == '\\' && source[idx+1] == 'u') {
- //-------------unicode traitement ------------
- int c1, c2, c3, c4;
- charLength++;
- while (source[idx+charLength] == 'u') charLength++;
- if (((c1 = ScannerHelper.getNumericValue(source[idx+charLength++])) > 15
- || c1 < 0)
- || ((c2 = ScannerHelper.getNumericValue(source[idx+charLength++])) > 15 || c2 < 0)
- || ((c3 = ScannerHelper.getNumericValue(source[idx+charLength++])) > 15 || c3 < 0)
- || ((c4 = ScannerHelper.getNumericValue(source[idx+charLength++])) > 15 || c4 < 0)) {
- return ch;
- }
- ch = (char) (((c1 * 16 + c2) * 16 + c3) * 16 + c4);
- chars = new String(source, pos, charLength);
- }
- return ch;
- }
- /*
- * Convert Javadoc source to match Javadoc.toString().
- * Store converted comments and their corresponding tags respectively
- * in comments and allTags fields
- */
- protected void setSourceComment(char[] source) throws ArrayIndexOutOfBoundsException {
- comments = new ArrayList();
- allTags = new ArrayList();
- StringBuffer buffer = null;
- int comment = 0;
- boolean end = false, lineStarted = false;
- String tag = null;
- List tags = new ArrayList();
- int length = source.length;
- char previousChar=0, currentChar=0;
- for (int i=0; i<length;) {
- previousChar = currentChar;
- // get next char
- currentChar = getNextChar(source, i);
- i += (chars==null) ? 1 : chars.length();
-
- //
- switch (comment) {
- case 0:
- switch (currentChar) {
- case '/':
- comment = 1; // first char for comments...
- buffer = new StringBuffer();
- if (chars == null) buffer.append(currentChar);
- else buffer.append(chars);
- break;
- case '\'':
- while (i<length) {
- // get next char
- currentChar = getNextChar(source, i);
- i += (chars==null) ? 1 : chars.length();
- if (currentChar == '\\') {
- // get next char
- currentChar = getNextChar(source, i);
- i += (chars==null) ? 1 : chars.length();
- } else {
- if (currentChar == '\'') {
- break;
- }
- }
- }
- break;
- case '"':
- while (i<length) {
- // get next char
- currentChar = getNextChar(source, i);
- i += (chars==null) ? 1 : chars.length();
- if (currentChar == '\\') {
- // get next char
- currentChar = getNextChar(source, i);
- i += (chars==null) ? 1 : chars.length();
- } else {
- if (currentChar == '"') {
- // get next char
- currentChar = getNextChar(source, i);
- if (currentChar == '"') {
- i += (chars==null) ? 1 : chars.length();
- } else {
- break;
- }
- }
- }
- }
- break;
- }
- break;
- case 1: // first '/' has been found...
- switch (currentChar) {
- case '/':
- if (chars == null) buffer.append(currentChar);
- else buffer.append(chars);
- comment = LINE_COMMENT;
- break;
- case '*':
- if (chars == null) buffer.append(currentChar);
- else buffer.append(chars);
- comment = 2; // next step
- break;
- default:
- comment = 0;
- break;
- }
- break;
- case 2: // '/*' has been found...
- if (currentChar == '*') {
- comment = 3; // next step...
- } else {
- comment = BLOCK_COMMENT;
- }
- if (chars == null) buffer.append(currentChar);
- else buffer.append(chars);
- break;
- case 3: // '/**' has bee found, verify that's not an empty block comment
- if (currentChar == '/') { // empty block comment
- if (chars == null) buffer.append(currentChar);
- else buffer.append(chars);
- comments.add(buffer.toString());
- allTags.add(new ArrayList());
- comment = 0;
- break;
- }
- // do not break, directly go to next case...
- comment = DOC_COMMENT;
- case DOC_COMMENT:
- if (tag != null) {
- if (currentChar >= 'a' && currentChar <= 'z') {
- tag += currentChar;
- } else {
- tags.add(tag);
- tag = null;
- }
- }
- switch (currentChar) {
- case '@':
- if (!lineStarted || previousChar == '{') {
- tag = "";
- lineStarted = true;
- }
- break;
- case '\r':
- case '\n':
- lineStarted = false;
- break;
- case '*':
- break;
- default:
- if (!Character.isWhitespace(currentChar)) {
- lineStarted = true;
- }
- }
- case BLOCK_COMMENT:
- if (chars == null) buffer.append(currentChar);
- else buffer.append(chars);
- if (end && currentChar == '/') {
- comment = 0;
- lineStarted = false;
- comments.add(buffer.toString());
- allTags.add(tags);
- tags = new ArrayList();
- }
- end = currentChar == '*';
- break;
- case LINE_COMMENT:
- if (currentChar == '\r' || currentChar == '\n') {
- /*
- if (currentChar == '\r' && source[i+1] == '\n') {
- buffer.append(source[++i]);
- }
- */
- comment = 0;
- comments.add(buffer.toString());
- allTags.add(tags);
- } else {
- if (chars == null) buffer.append(currentChar);
- else buffer.append(chars);
- }
- break;
- default:
- // do nothing
- break;
- }
- }
- }
-
- /*
- * Convert Javadoc source to match Javadoc.toString().
- * Store converted comments and their corresponding tags respectively
- * in comments and allTags fields
- */
- char[] getUnicodeSource(char[] source) {
- int length = source.length;
- int unicodeLength = length*6;
- char[] unicodeSource = new char[unicodeLength];
- int u=0;
- for (int i=0; i<length; i++) {
- // get next char
- if (source[i] == '\\' && source[i+1] == 'u') {
- //-------------unicode traitement ------------
- int c1, c2, c3, c4;
- unicodeSource[u++] = source[i];
- unicodeSource[u++] = source[++i];
- if (((c1 = ScannerHelper.getNumericValue(source[i+1])) > 15
- || c1 < 0)
- || ((c2 = ScannerHelper.getNumericValue(source[i+2])) > 15 || c2 < 0)
- || ((c3 = ScannerHelper.getNumericValue(source[i+3])) > 15 || c3 < 0)
- || ((c4 = ScannerHelper.getNumericValue(source[i+4])) > 15 || c4 < 0)) {
- throw new RuntimeException("Invalid unicode in source at "+i);
- }
- for (int j=0; j<4; j++) unicodeSource[u++] = source[++i];
- } else {
- unicodeSource[u++] = '\\';
- unicodeSource[u++] = 'u';
- unicodeSource[u++] = '0';
- unicodeSource[u++] = '0';
- int val = source[i]/16;
- unicodeSource[u++] = (char) (val<10 ? val+ 0x30 : val-10+0x61);
- val = source[i]%16;
- unicodeSource[u++] = (char) (val<10 ? val+ 0x30 : val-10+0x61);
- }
- }
- // Return one well sized array
- if (u != unicodeLength) {
- char[] result = new char[u];
- System.arraycopy(unicodeSource, 0, result, 0, u);
- return result;
- }
- return unicodeSource;
- }
-
- /*
- * Convert Javadoc source to match Javadoc.toString().
- * Store converted comments and their corresponding tags respectively
- * in comments and allTags fields
- */
- char[] getUnixSource(char[] source) {
- int length = source.length;
- int unixLength = length;
- char[] unixSource = new char[unixLength];
- int u=0;
- for (int i=0; i<length; i++) {
- // get next char
- if (source[i] == '\r' && source[i+1] == '\n') {
- i++;
- }
- unixSource[u++] = source[i];
- }
- // Return one well sized array
- if (u != unixLength) {
- char[] result = new char[u];
- System.arraycopy(unixSource, 0, result, 0, u);
- return result;
- }
- return unixSource;
- }
-
- /*
- * Return all tags number for a given Javadoc
- */
- int allTags(JSdoc docComment) {
- int all = 0;
- // Count main tags
- Iterator tags = docComment.tags().listIterator();
- while (tags.hasNext()) {
- TagElement tagElement = (TagElement) tags.next();
- if (tagElement.getTagName() != null) {
- all++;
- }
- Iterator fragments = tagElement.fragments().listIterator();
- while (fragments.hasNext()) {
- ASTNode node = (ASTNode) fragments.next();
- if (node.getNodeType() == ASTNode.TAG_ELEMENT) {
- all++;
- }
- }
- }
- return all;
- }
-
- /*
- * Add a failure to the list. Use only one method as it easier to put breakpoint to
- * debug failure when it occurs...
- */
- private void addFailure(String msg) {
- failures.add(msg);
- }
-
- /*
- * Put the failure message in list instead of throwing exception immediately.
- * This allow to store several failures per test...
- * @see tearDown method which finally throws the execption to signal that test fails.
- */
- protected void assumeTrue(String msg, boolean cond) {
- if (!cond) {
- addFailure(msg);
- if (stopOnFailure) assertTrue(msg, cond);
- }
- }
-
- /*
- * Put the failure message in list instead of throwing exception immediately.
- * This allow to store several failures per test...
- * @see tearDown method which finally throws the execption to signal that test fails.
- */
- protected void assumeNull(String msg, Object obj) {
- if (obj != null) {
- addFailure(msg);
- if (stopOnFailure) assertNull(msg, obj);
- }
- }
-
- /*
- * Put the failure message in list instead of throwing exception immediately.
- * This allow to store several failures per test...
- * @see tearDown method which finally throws the execption to signal that test fails.
- */
- protected void assumeNotNull(String msg, Object obj) {
- if (obj == null) {
- addFailure(msg);
- if (stopOnFailure) assertNotNull(msg, obj);
- }
- }
-
- /*
- * Put the failure message in list instead of throwing exception immediately.
- * This allow to store several failures per test...
- * @see tearDown method which finally throws the execption to signal that test fails.
- */
- protected void assumeEquals(String msg, int expected, int actual) {
- if (expected != actual) {
- addFailure(msg+", expected="+expected+" actual="+actual);
- if (stopOnFailure) assertEquals(msg, expected, actual);
- }
- }
-
- /*
- * Put the failure message in list instead of throwing exception immediately.
- * This allow to store several failures per test...
- * @see tearDown method which finally throws the execption to signal that test fails.
- */
- protected void assumeEquals(String msg, Object expected, Object actual) {
- if (expected == null && actual == null)
- return;
- if (expected != null && expected.equals(actual))
- return;
- addFailure(msg+", expected:<"+expected+"> actual:<"+actual+'>');
- if (stopOnFailure) assertEquals(msg, expected, actual);
- }
-
- /*
- * Verify positions of tags in source
- */
- private void verifyPositions(JSdoc docComment, char[] source) {
- boolean stop = stopOnFailure;
-// stopOnFailure = false;
- // Verify javadoc start and end position
- int start = docComment.getStartPosition();
- int end = start+docComment.getLength()-1;
- assumeTrue(prefix+"Misplaced javadoc start at <"+start+">: "+docComment, source[start++] == '/' && source[start++] == '*' && source[start++] == '*');
- // Get first meaningful character
- int tagStart = start;
- // Verify tags
- Iterator tags = docComment.tags().listIterator();
- while (tags.hasNext()) {
- while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) {
- tagStart++; // purge non-stored characters
- }
- TagElement tagElement = (TagElement) tags.next();
- int teStart = tagElement.getStartPosition();
- assumeEquals(prefix+"Wrong start position <"+teStart+"> for tag element: "+tagElement, tagStart, teStart);
- verifyPositions(tagElement, source);
- tagStart += tagElement.getLength();
- }
- while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) {
- tagStart++; // purge non-stored characters
- }
- assumeTrue(prefix+"Misplaced javadoc end at <"+tagStart+'>', source[tagStart-1] == '*' && source[tagStart] == '/');
- assumeEquals(prefix+"Wrong javadoc length at <"+end+">: ", tagStart, end);
- stopOnFailure = stop;
- assertTrue(!stop || failures.size()==0);
- }
-
- /**
- * Verify positions of fragments in source
- * @deprecated using deprecated code
- */
- private void verifyPositions(TagElement tagElement, char[] source) {
- String text = null;
- // Verify tag name
- String tagName = tagElement.getTagName();
- int tagStart = tagElement.getStartPosition();
- if (tagElement.isNested()) {
- assumeEquals(prefix+"Wrong start position <"+tagStart+"> for "+tagElement, '{', source[tagStart++]);
- }
- if (tagName != null) {
- text= new String(source, tagStart, tagName.length());
- assumeEquals(prefix+"Misplaced tag name at <"+tagStart+">: ", tagName, text);
- tagStart += tagName.length();
- }
- // Verify each fragment
- ASTNode previousFragment = null;
- Iterator elements = tagElement.fragments().listIterator();
- while (elements.hasNext()) {
- ASTNode fragment = (ASTNode) elements.next();
- if (fragment.getNodeType() == ASTNode.TEXT_ELEMENT) {
- if (previousFragment == null && TagElement.TAG_PARAM.equals(tagName) && ((TextElement)fragment).getText().equals("<")) { // special case here for @param <E> syntax
- int start = tagStart;
- // verify '<'
- while (source[start] == ' ' || Character.isWhitespace(source[start])) {
- start++; // purge white characters
- }
- text = new String(source, start, fragment.getLength());
- assumeEquals(prefix+"Misplaced text element at <"+fragment.getStartPosition()+">: ", text, ((TextElement) fragment).getText());
- start += fragment.getLength();
- // verify simple name
- assumeTrue(prefix+"Unexpected fragment end for "+tagElement, elements.hasNext());
- fragment = (ASTNode) elements.next();
- while (source[start] == ' ' || Character.isWhitespace(source[start])) {
- start++; // purge white characters
- }
- assumeEquals(prefix+"Unexpected node type for tag element "+tagElement, ASTNode.SIMPLE_NAME, fragment.getNodeType());
- Name name = (Name) fragment;
- verifyNamePositions(start, name, source);
- start += fragment.getLength();
- // verify simple name
- assumeTrue(prefix+"Unexpected fragment end for "+tagElement, elements.hasNext());
- fragment = (ASTNode) elements.next();
- while (source[start] == ' ' || Character.isWhitespace(source[start])) {
- start++; // purge white characters
- }
- text = new String(source, start, fragment.getLength());
- assumeEquals(prefix+"Misplaced text element at <"+fragment.getStartPosition()+">: ", text, ((TextElement) fragment).getText());
- start += fragment.getLength();
- // reset fragment as simple name to avoid issue with next text element
- fragment = name;
- tagStart += (start- tagStart) - name.getLength();
- } else {
- if (previousFragment == null) {
- if (tagName != null && (source[tagStart] == '\r' || source[tagStart] == '\n')) {
- while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) {
- tagStart++; // purge non-stored characters
- }
- }
- } else {
- if (previousFragment.getNodeType() == ASTNode.TEXT_ELEMENT) {
- assumeTrue(prefix+"Wrong length at <"+previousFragment.getStartPosition()+"> for text element "+previousFragment, (source[tagStart] == '\r' /* && source[tagStart+1] == '\n' */ || source[tagStart] == '\n'));
- while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) {
- tagStart++; // purge non-stored characters
- }
- } else if (TagElement.TAG_PARAM.equals(tagName) && previousFragment.getNodeType() == ASTNode.SIMPLE_NAME && ((TextElement)fragment).getText().equals(">")) {
- while (source[tagStart] == ' ' || Character.isWhitespace(source[tagStart])) {
- tagStart++; // purge white characters
- }
- } else {
- int start = tagStart;
- boolean newLine = false;
- while (source[start] == '*' || Character.isWhitespace(source[start])) {
- start++; // purge non-stored characters
- if (source[tagStart] == '\r' || source[tagStart] == '\n') {
- newLine = true;
- }
- }
- if (newLine) tagStart = start;
- }
- }
- text = new String(source, tagStart, fragment.getLength());
- assumeEquals(prefix+"Misplaced text element at <"+fragment.getStartPosition()+">: ", text, ((TextElement) fragment).getText());
- }
- } else {
- while (source[tagStart] == '*' || Character.isWhitespace(source[tagStart])) {
- tagStart++; // purge non-stored characters
- }
- if (fragment.getNodeType() == ASTNode.SIMPLE_NAME || fragment.getNodeType() == ASTNode.QUALIFIED_NAME) {
- verifyNamePositions(tagStart, (Name) fragment, source);
- } else if (fragment.getNodeType() == ASTNode.TAG_ELEMENT) {
- TagElement inlineTag = (TagElement) fragment;
- assumeEquals(prefix+"Tag element <"+inlineTag+"> has wrong start position", tagStart, inlineTag.getStartPosition());
- verifyPositions(inlineTag, source);
- } else if (fragment.getNodeType() == ASTNode.MEMBER_REF) {
- MemberRef memberRef = (MemberRef) fragment;
- // Store start position
- int start = tagStart;
- // Verify qualifier position
- Name qualifier = memberRef.getQualifier();
- if (qualifier != null) {
- verifyNamePositions(start, qualifier, source);
- start += qualifier.getLength();
- while (source[start] == '*' || Character.isWhitespace(source[start])) {
- start++; // purge non-stored characters
- }
- }
- // Verify member separator position
- assumeEquals(prefix+"Misplaced # separator at <"+start+"> for member ref "+memberRef, '#', source[start]);
- start++;
- while (source[start] == '*' || Character.isWhitespace(source[start])) {
- start++; // purge non-stored characters
- }
- // Verify member name position
- Name name = memberRef.getName();
- text = new String(source, start, name.getLength());
- assumeEquals(prefix+"Misplaced member ref at <"+start+">: ", text, name.toString());
- verifyNamePositions(start, name, source);
- } else if (fragment.getNodeType() == ASTNode.FUNCTION_REF) {
- FunctionRef methodRef = (FunctionRef) fragment;
- // Store start position
- int start = tagStart;
- // Verify qualifier position
- Name qualifier = methodRef.getQualifier();
- if (qualifier != null) {
- verifyNamePositions(start, qualifier, source);
- start += qualifier.getLength();
- while (source[start] == '*' || Character.isWhitespace(source[start])) {
- start++; // purge non-stored characters
- }
- }
- // Verify member separator position
- assumeEquals(prefix+"Misplaced # separator at <"+start+"> for method ref: "+methodRef, '#', source[start]);
- start++;
- while (source[start] == '*' || Character.isWhitespace(source[start])) {
- start++; // purge non-stored characters
- }
- // Verify member name position
- Name name = methodRef.getName();
- int nameLength = name.getLength();
- text = new String(source, start, nameLength);
- if (!text.equals(name.toString())) { // may have qualified constructor reference for inner classes
- if (methodRef.getQualifier().isQualifiedName()) {
- text = new String(source, start, methodRef.getQualifier().getLength());
- assumeEquals(prefix+"Misplaced method ref name at <"+start+">: ", text, methodRef.getQualifier().toString());
- while (source[start] != '.' || Character.isWhitespace(source[start])) {
- start++; // purge non-stored characters
- }
- start++;
- } else {
- while (source[start] != '.' || Character.isWhitespace(source[start])) {
- start++; // purge non-stored characters
- }
- start++;
- text = new String(source, start, nameLength);
- assumeEquals(prefix+"Misplaced method ref name at <"+start+">: ", text, name.toString());
- }
- }
- verifyNamePositions(start, name, source);
- start += nameLength;
- // Verify arguments starting open parenthesis
- while (source[start] == '*' || Character.isWhitespace(source[start])) {
- start++; // purge non-stored characters
- }
-// assumeEquals(prefix+"Misplaced ( at <"+start+"> for method ref: "+methodRef, '(', source[start]);
- if (source[start] == '(') { // now method reference may have no parenthesis...
- start++;
- // Verify parameters
- Iterator parameters = methodRef.parameters().listIterator();
- while (parameters.hasNext()) {
- FunctionRefParameter param = (FunctionRefParameter) parameters.next();
- boolean lastParam = !parameters.hasNext();
- // Verify parameter type positions
- while (source[start] == '*' || Character.isWhitespace(source[start])) {
- start++; // purge non-stored characters
- }
- Type type = param.getType();
- if (type.isSimpleType()) {
- verifyNamePositions(start, ((SimpleType)type).getName(), source);
- } else if (type.isPrimitiveType()) {
- text = new String(source, start, type.getLength());
- assumeEquals(prefix+"Misplaced method ref parameter type at <"+start+"> for method ref: "+methodRef, text, type.toString());
- } else if (type.isArrayType()) {
- Type elementType = ((ArrayType) param.getType()).getElementType();
- if (elementType.isSimpleType()) {
- verifyNamePositions(start, ((SimpleType)elementType).getName(), source);
- } else if (elementType.isPrimitiveType()) {
- text = new String(source, start, elementType.getLength());
- assumeEquals(prefix+"Misplaced method ref parameter type at <"+start+"> for method ref: "+methodRef, text, elementType.toString());
- }
- }
- start += type.getLength();
- // if last param then perhaps a varargs
- while (Character.isWhitespace(source[start])) { // do NOT accept '*' in parameter declaration
- start++; // purge non-stored characters
- }
- if (lastParam && this.astLevel != AST.JLS2 && param.isVarargs()) {
- for (int p=0;p<3;p++) {
- assumeTrue(prefix+"Missing ellipsis for vararg method ref parameter at <"+start+"> for method ref: "+methodRef, source[start++]=='.');
- }
- }
- // Verify parameter name positions
- while (Character.isWhitespace(source[start])) { // do NOT accept '*' in parameter declaration
- start++; // purge non-stored characters
- }
- name = param.getName();
- if (name != null) {
- text = new String(source, start, name.getLength());
- assumeEquals(prefix+"Misplaced method ref parameter name at <"+start+"> for method ref: "+methodRef, text, name.toString());
- start += name.getLength();
- }
- // Verify end parameter declaration
- while (source[start] == '*' || Character.isWhitespace(source[start])) {
- start++;
- }
- assumeTrue(prefix+"Misplaced parameter end at <"+start+"> for method ref: "+methodRef, source[start] == ',' || source[start] == ')');
- start++;
- if (source[start] == ')') {
- break;
- }
- }
- }
- }
- }
- tagStart += fragment.getLength();
- previousFragment = fragment;
- }
- if (tagElement.isNested()) {
- assumeEquals(prefix+"Wrong end character at <"+tagStart+"> for "+tagElement, '}', source[tagStart++]);
- }
- }
-
- /*
- * Verify each name component positions.
- */
- private void verifyNamePositions(int nameStart, Name name, char[] source) {
- if (name.isQualifiedName()) {
- QualifiedName qualified = (QualifiedName) name;
- int start = qualified.getName().getStartPosition();
- String str = new String(source, start, qualified.getName().getLength());
- assumeEquals(prefix+"Misplaced or wrong name for qualified name: "+name, str, qualified.getName().toString());
- verifyNamePositions(nameStart, ((QualifiedName) name).getQualifier(), source);
- }
- String str = new String(source, nameStart, name.getLength());
- if (str.indexOf('\n') < 0) { // cannot compare if text contains new line
- assumeEquals(prefix+"Misplaced name for qualified name: ", str, name.toString());
- } else if (debug) {
- System.out.println(prefix+"Name contains new line for qualified name: "+name);
- }
- }
-
- /*
- * Verify that bindings of Javadoc comment structure are resolved or not.
- * For expected unresolved binding, verify that following text starts with 'Unknown'
- */
- private void verifyBindings(JSdoc docComment) {
- boolean stop = stopOnFailure;
-// stopOnFailure = false;
- // Verify tags
- Iterator tags = docComment.tags().listIterator();
- while (tags.hasNext()) {
- verifyBindings((TagElement) tags.next());
- }
- stopOnFailure = stop;
- assertTrue(!stop || failures.size()==0);
- }
-
- /*
- * Verify that bindings of Javadoc tag structure are resolved or not.
- * For expected unresolved binding, verify that following text starts with 'Unknown'
- */
- private void verifyBindings(TagElement tagElement) {
- // Verify each fragment
- Iterator elements = tagElement.fragments().listIterator();
- IBinding previousBinding = null;
- ASTNode previousFragment = null;
- boolean resolvedBinding = false;
- while (elements.hasNext()) {
- ASTNode fragment = (ASTNode) elements.next();
- if (fragment.getNodeType() == ASTNode.TEXT_ELEMENT) {
- TextElement text = (TextElement) fragment;
- if (resolvedBinding) {
- if (previousBinding == null) {
- assumeTrue(prefix+"Reference '"+previousFragment+"' should be bound!", text.getText().trim().indexOf("Unknown")>=0);
- } else {
- assumeTrue(prefix+"Unknown reference '"+previousFragment+"' should NOT be bound!", text.getText().trim().indexOf("Unknown")<0);
- }
- }
- previousBinding = null;
- resolvedBinding = false;
- } else if (fragment.getNodeType() == ASTNode.TAG_ELEMENT) {
- verifyBindings((TagElement) fragment);
- previousBinding = null;
- resolvedBinding = false;
- } else {
- resolvedBinding = true;
- if (fragment.getNodeType() == ASTNode.SIMPLE_NAME) {
- previousBinding = ((Name)fragment).resolveBinding();
- } else if (fragment.getNodeType() == ASTNode.QUALIFIED_NAME) {
- QualifiedName name = (QualifiedName) fragment;
- previousBinding = name.resolveBinding();
- verifyNameBindings(name);
- } else if (fragment.getNodeType() == ASTNode.MEMBER_REF) {
- MemberRef memberRef = (MemberRef) fragment;
- previousBinding = memberRef.resolveBinding();
- if (previousBinding != null) {
- SimpleName name = memberRef.getName();
- assumeNotNull(prefix+""+name+" binding was not foundfound in "+fragment, name.resolveBinding());
- verifyNameBindings(memberRef.getQualifier());
- }
- } else if (fragment.getNodeType() == ASTNode.FUNCTION_REF) {
- FunctionRef methodRef = (FunctionRef) fragment;
- previousBinding = methodRef.resolveBinding();
- if (previousBinding != null) {
- SimpleName methodName = methodRef.getName();
- IBinding methNameBinding = methodName.resolveBinding();
- Name methodQualifier = methodRef.getQualifier();
- // TODO (frederic) Replace the two following lines by commented block when bug https://bugs.eclipse.org/bugs/show_bug.cgi?id=62650 will be fixed
- assumeNotNull(prefix+""+methodName+" binding was not found in "+fragment, methNameBinding);
- verifyNameBindings(methodQualifier);
- /*
- if (methodQualifier == null) {
- if (methNameBinding == null) {
- char firstChar = methodName.getIdentifier().charAt(0);
- if (Character.isUpperCase(firstChar)) {
- // assume that selector starting with uppercase is for constructor => signal that binding is null
- System.out.println(prefix+"Binding for selector of '"+methodRef+"' is null.");
- }
- } else {
- if (methNameBinding.getName().equals(methodName.getIdentifier())) { // binding is not null only for constructor
- assumeNotNull(prefix+""+methodName+" binding was not found!",methNameBinding);
- } else {
- assumeNull(prefix+""+methodName+" binding should be null!", methNameBinding);
- }
- }
- } else {
- SimpleName methodSimpleType = null;
- if (methodQualifier.isQualifiedName()) {
- methodSimpleType = ((QualifiedName)methodQualifier).getName();
- } else {
- methodSimpleType = (SimpleName) methodQualifier;
- }
- if (methodSimpleType.getIdentifier().equals(methodName.getIdentifier())) { // binding is not null only for constructor
- assumeNotNull(prefix+""+methodName+" binding was not found!",methNameBinding);
- } else {
- assumeNull(prefix+""+methodName+" binding should be null!", methNameBinding);
- }
- verifyNameBindings(methodRef.getQualifier());
- }
- */
- Iterator parameters = methodRef.parameters().listIterator();
- while (parameters.hasNext()) {
- FunctionRefParameter param = (FunctionRefParameter) parameters.next();
- Type type = param.getType();
- assumeNotNull(prefix+""+type+" binding was not found in "+fragment, type.resolveBinding());
- if (type.isSimpleType()) {
- verifyNameBindings(((SimpleType)type).getName());
- } else if (type.isArrayType()) {
- Type elementType = ((ArrayType) param.getType()).getElementType();
- assumeNotNull(prefix+""+elementType+" binding was not found in "+fragment, elementType.resolveBinding());
- if (elementType.isSimpleType()) {
- verifyNameBindings(((SimpleType)elementType).getName());
- }
- }
- // Do not verify parameter name as no binding is expected for them
- }
- }
- }
- }
- previousFragment = fragment;
- }
- assumeTrue(prefix+"Reference '"+(previousFragment==null?tagElement:previousFragment)+"' should be bound!", (!resolvedBinding || previousBinding != null));
- }
-
- /*
- * Verify each name component binding.
- */
- private void verifyNameBindings(Name name) {
- if (name != null) {
- IBinding binding = name.resolveBinding();
- if (name.toString().indexOf("Unknown") > 0) {
- assumeNull(prefix+name+" binding should be null!", binding);
- } else {
- assumeNotNull(prefix+name+" binding was not found!", binding);
- }
- SimpleName simpleName = null;
- int index = 0;
- while (name.isQualifiedName()) {
- simpleName = ((QualifiedName) name).getName();
- binding = simpleName.resolveBinding();
- if (simpleName.getIdentifier().equalsIgnoreCase("Unknown")) {
- assumeNull(prefix+simpleName+" binding should be null!", binding);
- } else {
- assumeNotNull(prefix+simpleName+" binding was not found!", binding);
- }
- if (index > 0 && packageBinding) {
- assumeEquals(prefix+"Wrong binding type!", IBinding.PACKAGE, binding.getKind());
- }
- index++;
- name = ((QualifiedName) name).getQualifier();
- binding = name.resolveBinding();
- if (name.toString().indexOf("Unknown") > 0) {
- assumeNull(prefix+name+" binding should be null!", binding);
- } else {
- assumeNotNull(prefix+name+" binding was not found!", binding);
- }
- if (packageBinding) {
- assumeEquals(prefix+"Wrong binding type!", IBinding.PACKAGE, binding.getKind());
- }
- }
- }
- }
-
- /* (non-Javadoc)
- * @see junit.framework.TestCase#setUp()
- */
- protected void verifyComments(String test) throws JavaScriptModelException {
- IJavaScriptUnit[] units = getCompilationUnits("Converter" , "src", "javadoc."+test); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- for (int i=0; i<units.length; i++) {
- verifyComments(units[i]);
- }
- }
-
- /*
- * Verify the comments of a compilation unit.
- */
- protected void verifyWorkingCopiesComments() throws JavaScriptModelException {
- assumeNotNull("No working copies to verify!", workingCopies);
- int length = workingCopies.length;
- assumeTrue("We need to have at least one working copy to verify!", length>0);
- for (int i=0; i<length; i++) {
- verifyComments(workingCopies[i]);
- }
- }
-
- /*
- * Verify the comments of a compilation unit.
- */
- protected JavaScriptUnit verifyComments(IJavaScriptUnit unit) throws JavaScriptModelException {
- // Get test file
- sourceUnit = unit;
- prefix = unit.getElementName()+": ";
-
- // Get current project
- String sourceStr = sourceUnit.getSource();
- if (savedOptions != null && !sourceUnit.getJavaScriptProject().getElementName().equals(currentProject.getElementName())) {
- currentProject.setOptions(savedOptions);
- savedOptions = null;
- }
- currentProject = sourceUnit.getJavaScriptProject();
- if (savedOptions == null) savedOptions = currentProject.getOptions(false);
-
- // set up java project options
- currentProject.setOption(JavaScriptCore.COMPILER_PB_INVALID_JAVADOC, compilerOption);
- currentProject.setOption(JavaScriptCore.COMPILER_PB_MISSING_JAVADOC_TAGS, compilerOption);
- currentProject.setOption(JavaScriptCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS, compilerOption);
- currentProject.setOption(JavaScriptCore.COMPILER_PB_METHOD_WITH_CONSTRUCTOR_NAME, JavaScriptCore.IGNORE);
- currentProject.setOption(JavaScriptCore.COMPILER_DOC_COMMENT_SUPPORT, docCommentSupport);
-
- // Verify source regardings converted comments
- char[] source = sourceStr.toCharArray();
- String fileName = unit.getPath().toString();
- try {
- return verifyComments(fileName, source);
- }
- catch (RuntimeException ex) {
- TEST_COUNTERS[3]++;
- throw ex;
- }
- }
-
- protected JavaScriptUnit verifyComments(String fileName, char[] source) {
- return verifyComments(fileName, source, null);
- }
-
- protected JavaScriptUnit verifyComments(String fileName, char[] source, Map options) {
-
- // Verify comments either in unicode or not
- char[] testedSource = source;
- if (UNICODE) {
- testedSource = getUnicodeSource(source);
- }
-
- // Verify comments either in unicode or not
- else if (unix) {
- testedSource = getUnixSource(source);
- }
-
- // Get comments infos from test file
- setSourceComment(testedSource);
-
- // Create DOM AST nodes hierarchy
- List unitComments = null;
- String sourceLevel = null;
- String complianceLevel = null;
- if (currentProject != null) {
- if (astLevel == AST.JLS3) {
- complianceLevel = currentProject.getOption(JavaScriptCore.COMPILER_COMPLIANCE, true);
- sourceLevel = currentProject.getOption(JavaScriptCore.COMPILER_SOURCE, true);
- currentProject.setOption(JavaScriptCore.COMPILER_COMPLIANCE, JavaScriptCore.VERSION_1_5);
- currentProject.setOption(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_5);
- }
- }
- JavaScriptUnit compilUnit = (JavaScriptUnit) runConversion(testedSource, fileName, currentProject, options);
- if (compilerOption.equals(JavaScriptCore.ERROR)) {
- assumeEquals(prefix+"Unexpected problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$
- } else if (compilerOption.equals(JavaScriptCore.WARNING)) {
- IProblem[] problemsList = compilUnit.getProblems();
- int length = problemsList.length;
- if (length > 0) {
- problems.append(" - "+prefix+length+" problems:"); //$NON-NLS-1$
- for (int i = 0; i < problemsList.length; i++) {
- problems.append(" + ");
- problems.append(problemsList[i]);
- problems.append("\n");
- }
- }
- }
- unitComments = compilUnit.getCommentList();
- assumeNotNull(prefix+"Unexpected problems", unitComments);
-
- // Basic comments verification
- int size = unitComments.size();
- assumeEquals(prefix+"Wrong number of comments!", comments.size(), size);
-
- // Verify comments positions and bindings
- for (int i=0; i<size; i++) {
- Comment comment = (Comment) unitComments.get(i);
- List tags = (List) allTags.get(i);
- // Verify flattened content
- String stringComment = (String) comments.get(i);
-// ASTConverterJavadocFlattener printer = new ASTConverterJavadocFlattener(stringComment);
-// comment.accept(printer);
- String text = new String(testedSource, comment.getStartPosition(), comment.getLength());
- assumeEquals(prefix+"Flattened comment does NOT match source!", stringComment, text);
- // Verify javdoc tags positions and bindings
- if (comment.isDocComment()) {
- JSdoc docComment = (JSdoc)comment;
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- assumeEquals(prefix+"Invalid tags number in javadoc:\n"+docComment+"\n", tags.size(), allTags(docComment));
- verifyPositions(docComment, testedSource);
- if (resolveBinding) {
- verifyBindings(docComment);
- }
- } else {
- assumeEquals("Javadoc should be flat!", 0, docComment.tags().size());
- }
- }
- }
-
- /* Verify each javadoc: not implemented yet
- Iterator types = compilUnit.types().listIterator();
- while (types.hasNext()) {
- TypeDeclaration typeDeclaration = (TypeDeclaration) types.next();
- verifyJavadoc(typeDeclaration.getJavadoc());
- }
- */
-
- if (sourceLevel != null) {
- currentProject.setOption(JavaScriptCore.COMPILER_COMPLIANCE, complianceLevel);
- currentProject.setOption(JavaScriptCore.COMPILER_SOURCE, sourceLevel);
- }
- // Return compilation unit for possible further verifications
- return compilUnit;
- }
-
- /*
- * Verify each javadoc
- * Not implented yet
- private void verifyJavadoc(Javadoc docComment) {
- }
- */
-
- /**
- * Check javadoc for FunctionDeclaration
- */
- public void test000() throws JavaScriptModelException {
- verifyComments("test000");
- }
-
- /**
- * Check javadoc for invalid syntax
- */
- public void test001() throws JavaScriptModelException {
- verifyComments("test001");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50781"
- */
- public void test002() throws JavaScriptModelException {
- verifyComments("test002");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50784"
- */
- public void test003() throws JavaScriptModelException {
- verifyComments("test003");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50785"
- */
- public void test004() throws JavaScriptModelException {
- verifyComments("test004");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50838"
- */
- public void test005() throws JavaScriptModelException {
- verifyComments("test005");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50877"
- */
- public void test006() throws JavaScriptModelException {
- verifyComments("test006");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50877"
- */
- public void test007() throws JavaScriptModelException {
- verifyComments("test007");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50877"
- */
- public void test008() throws JavaScriptModelException {
- verifyComments("test008");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50877"
- */
- public void test009() throws JavaScriptModelException {
- verifyComments("test009");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50880"
- */
- public void test010() throws JavaScriptModelException {
- verifyComments("test010");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=47396"
- */
- public void test011() throws JavaScriptModelException {
- problems = new StringBuffer();
- sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.test011", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assumeNotNull("No compilation unit", result);
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50938"
- */
- public void test012() throws JavaScriptModelException {
- verifyComments("test012");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51104"
- */
- public void test013() throws JavaScriptModelException {
- verifyComments("test013");
- }
-
- /**
- * Verify that text on next line following empty tag element
- * is well positionned.
- */
- public void test014() throws JavaScriptModelException {
- verifyComments("test014");
- }
-
- /**
- * Verify that we do not report failure when types are written on several lines
- * in Javadoc comments.
- */
- public void test015() throws JavaScriptModelException {
- verifyComments("test015");
- }
-
- /**
- * Verify DefaultCommentMapper heuristic to get leading and trailing comments
- */
- protected void verifyMapper(String folder, int count, int[] indexes) throws JavaScriptModelException {
- IJavaScriptUnit[] units = getCompilationUnits("Converter" , "src", "javadoc."+folder); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- for (int i=0; i<units.length; i++) {
- sourceUnit = units[i];
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit compilUnit = (JavaScriptUnit) result;
- assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$
- assumeEquals(prefix+"Wrong number of comments", count, compilUnit.getCommentList().size());
- // Verify first method existence
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration method = (FunctionDeclaration) node;
- // Verify first method extended positions
- int commentStart = method.getStartPosition();
- if (indexes[0]>=0) {
- Comment comment = (Comment) compilUnit.getCommentList().get(indexes[0]);
- commentStart = comment.getStartPosition();
- }
- int startPosition = compilUnit.getExtendedStartPosition(method);
- assumeEquals("Method "+node+" does not start at the right position", commentStart, startPosition);
- int methodEnd = startPosition + compilUnit.getExtendedLength(method) - 1;
- int commentEnd = method.getStartPosition() + method.getLength() - 1;
- if (indexes[1]>=0) {
- Comment comment = (Comment) compilUnit.getCommentList().get(indexes[1]);
- commentEnd = comment.getStartPosition() + comment.getLength() - 1;
- }
- assumeEquals("Method "+node+" does not have the correct length", commentEnd, methodEnd);
- // Verify second method existence
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- method = (FunctionDeclaration) node;
- // Verify second method extended positions
- commentStart = method.getStartPosition();
- if (indexes[2]>=0) {
- Comment comment = (Comment) compilUnit.getCommentList().get(indexes[2]);
- commentStart = comment.getStartPosition();
- }
- startPosition = compilUnit.getExtendedStartPosition(method);
- assumeEquals("Method "+node+" does not start at the right position", commentStart, startPosition);
- methodEnd = startPosition + compilUnit.getExtendedLength(method) - 1;
- commentEnd = method.getStartPosition() + method.getLength() - 1;
- if (indexes[3]>=0) {
- Comment comment = (Comment) compilUnit.getCommentList().get(indexes[3]);
- commentEnd = comment.getStartPosition() + comment.getLength() - 1;
- }
- assumeEquals("Method "+node+" does not have the correct length", commentEnd, methodEnd);
- }
- }
-
- /**
- * Verify DefaultCommentMapper heuristic to get leading and trailing comments
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=53445"
- */
- public void test100() throws JavaScriptModelException {
- verifyMapper("test100", 16, new int[] {2,7,8,15});
- }
- public void test101() throws JavaScriptModelException {
- verifyMapper("test101", 8, new int[] {1,3,4,7});
- }
- public void test102() throws JavaScriptModelException {
- verifyMapper("test102", 16, new int[] {4,9,10,13});
- }
- public void test103() throws JavaScriptModelException {
- verifyMapper("test103", 8, new int[] {2,4,5,6});
- }
- public void test104() throws JavaScriptModelException {
- verifyMapper("test104", 16, new int[] {2,7,8,15});
- }
- public void test105() throws JavaScriptModelException {
- verifyMapper("test105", 16, new int[] {-1,11,-1,15});
- }
- public void test106() throws JavaScriptModelException {
- verifyMapper("test106", 8, new int[] {-1,5,-1,7});
- }
- public void test107() throws JavaScriptModelException {
- verifyMapper("test107", 16, new int[] {2,7,8,-1});
- }
- public void test108() throws JavaScriptModelException {
- verifyMapper("test108", 8, new int[] {1,3,4,-1});
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=54776"
- */
- public void testBug54776() throws JavaScriptModelException {
- sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug54776", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit compilUnit = (JavaScriptUnit) result;
- assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$
- assumeEquals(prefix+"Wrong number of comments", 2, compilUnit.getCommentList().size());
- // get comments range
- Comment comment = (Comment) compilUnit.getCommentList().get(0);
- int commentStart = comment.getStartPosition();
- int extendedLength = ((Comment) compilUnit.getCommentList().get(1)).getStartPosition()-commentStart+comment.getLength();
- // get method invocation in field initializer
- ASTNode node = getASTNode((JavaScriptUnit) result, 0);
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDecl = (TypeDeclaration) node;
- FieldDeclaration[] fields = typeDecl.getFields();
- assumeEquals("We should have a field declaration", 1, fields.length);
- List fragments = fields[0].fragments();
- assumeEquals("We should have a variable fragment", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assumeTrue("We should get an expression", expression instanceof FunctionInvocation);
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- // verify that methodinvocation extended range includes leading and trailing comment
- int methodStart = compilUnit.getExtendedStartPosition(methodInvocation);
- assumeEquals("Method invocation "+methodInvocation+" does not start at the right position", commentStart, methodStart);
- int methodLength = compilUnit.getExtendedLength(methodInvocation);
- assumeEquals("Method invocation "+methodInvocation+" does not have the correct length", extendedLength, methodLength);
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=55221"
- */
- public void testBug55221a() throws JavaScriptModelException {
- sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55221.a", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit compilUnit = (JavaScriptUnit) result;
- assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$
- assumeEquals(prefix+"Wrong number of comments", 1, compilUnit.getCommentList().size());
- // Get comment range
- Comment comment = (Comment) compilUnit.getCommentList().get(0);
- int commentStart = comment.getStartPosition();
- // get first method
- ASTNode node = getASTNode(compilUnit, 0, 0);
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration method = (FunctionDeclaration) node;
- // verify that first method does not include comment
- int methodStart = compilUnit.getExtendedStartPosition(method);
- assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart);
- int methodLength = compilUnit.getExtendedLength(method);
- assumeEquals("Method declaration "+method+" does not end at the right position",method.getLength(), methodLength);
- // get method body
- node = method.getBody();
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not a block", node.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$
- Block block = (Block) node;
- // verify that body does not include following comment
- int blockStart = compilUnit.getExtendedStartPosition(block);
- assumeEquals("Body block "+block+" does not start at the right position", block.getStartPosition(), blockStart);
- int blockLength = compilUnit.getExtendedLength(block);
- assumeEquals("Body block "+block+" does not have the correct length", block.getLength(), blockLength);
- // get second method
- node = getASTNode(compilUnit, 0, 1);
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- method = (FunctionDeclaration) node;
- // verify that second method start includes comment
- assumeEquals("Method declaration "+method+" does not start at the right position", commentStart, method.getStartPosition());
- }
- public void testBug55221b() throws JavaScriptModelException {
- sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55221.b", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit compilUnit = (JavaScriptUnit) result;
- assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$
- assumeEquals(prefix+"Wrong number of comments", 1, compilUnit.getCommentList().size());
- // Get comment range
- Comment comment = (Comment) compilUnit.getCommentList().get(0);
- int commentStart = comment.getStartPosition();
- // get first method
- ASTNode node = getASTNode(compilUnit, 0, 0);
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration method = (FunctionDeclaration) node;
- // verify that first method does not include comment
- int methodStart = compilUnit.getExtendedStartPosition(method);
- assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart);
- int methodLength = compilUnit.getExtendedLength(method);
- assumeEquals("Method declaration "+method+" does not end at the right position",method.getLength(), methodLength);
- // get method body
- node = method.getBody();
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not a block", node.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$
- Block block = (Block) node;
- // verify that body does not include following comment
- int blockStart = compilUnit.getExtendedStartPosition(block);
- assumeEquals("Body block "+block+" does not start at the right position", block.getStartPosition(), blockStart);
- int blockLength = compilUnit.getExtendedLength(block);
- assumeEquals("Body block "+block+" does not have the correct length", block.getLength(), blockLength);
- // get second method
- node = getASTNode(compilUnit, 0, 1);
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- method = (FunctionDeclaration) node;
- // verify that second method start includes comment
- assumeEquals("Method declaration "+method+" does not start at the right position", commentStart, method.getStartPosition());
- }
- public void testBug55221c() throws JavaScriptModelException {
- sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55221.c", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit compilUnit = (JavaScriptUnit) result;
- assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$
- assumeEquals(prefix+"Wrong number of comments", 1, compilUnit.getCommentList().size());
- // Get comment range
- Comment comment = (Comment) compilUnit.getCommentList().get(0);
- int commentStart = comment.getStartPosition();
- int commentEnd = commentStart+comment.getLength()-1;
- // get first method
- ASTNode node = getASTNode(compilUnit, 0, 0);
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration method = (FunctionDeclaration) node;
- // verify that first method includes comment
- int methodStart = compilUnit.getExtendedStartPosition(method);
- assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart);
- int methodLength = compilUnit.getExtendedLength(method);
- assumeEquals("Method "+method+" does not end at the right position", commentEnd, methodStart+methodLength-1);
- // get method body
- node = method.getBody();
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not a block", node.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$
- Block block = (Block) node;
- // verify that body includes following comment
- int blockStart = compilUnit.getExtendedStartPosition(block);
- assumeEquals("Body block "+block+" does not start at the right position", block.getStartPosition(), blockStart);
- int blockLength = compilUnit.getExtendedLength(block);
- assumeEquals("Body block "+block+" does not end at the right position", commentEnd, blockStart+blockLength-1);
- // get second method
- node = getASTNode(compilUnit, 0, 1);
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- method = (FunctionDeclaration) node;
- // verify that second method does not include comment
- methodStart = compilUnit.getExtendedStartPosition(method);
- assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart);
- methodLength = compilUnit.getExtendedLength(method);
- assumeEquals("Method declaration "+method+" does not end at the right position",method.getLength(), methodLength);
- }
- /** @deprecated using deprecated code */
- public void testBug55221d() throws JavaScriptModelException {
- sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55221.d", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit compilUnit = (JavaScriptUnit) result;
- assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$
- assumeEquals(prefix+"Wrong number of comments", 2, compilUnit.getCommentList().size());
- // get first method
- ASTNode node = getASTNode(compilUnit, 0, 0);
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration method = (FunctionDeclaration) node;
- // verify that first method includes comment
- int methodStart = compilUnit.getExtendedStartPosition(method);
- assumeEquals("Method "+method+" does not start at the right position", method.getStartPosition(), methodStart);
- int methodLength = compilUnit.getExtendedLength(method);
- assumeEquals("Method "+method+" does not have the right length", methodLength, method.getLength());
- // get return type
- node = method.getReturnType();
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not return type", node.getNodeType() == ASTNode.PRIMITIVE_TYPE); //$NON-NLS-1$
- PrimitiveType returnType = (PrimitiveType) node;
- // verify that return type includes following comment
- int returnStart = compilUnit.getExtendedStartPosition(returnType);
- assumeEquals("Return type "+returnType+" does not start at the right position", returnType.getStartPosition(), returnStart);
- int returnLength = compilUnit.getExtendedLength(returnType);
- assumeEquals("Return type "+returnType+" does not have the right length", returnType.getLength(), returnLength);
- }
- public void testBug55223a() throws JavaScriptModelException {
-// stopOnFailure = false;
- sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55223", "TestA.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit compilUnit = (JavaScriptUnit) result;
- assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$
- assumeEquals(prefix+"Wrong number of comments", 2, compilUnit.getCommentList().size());
- // get method
- ASTNode node = getASTNode(compilUnit, 0, 0);
- assumeNotNull("We should get a non-null ast node", node);
- assumeEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- FunctionDeclaration method = (FunctionDeclaration) node;
- // get method body
- node = method.getBody();
- assumeNotNull("We should get a non-null ast node", node);
- assumeEquals("Not a block", ASTNode.BLOCK, node.getNodeType()); //$NON-NLS-1$
- Block block = (Block) node;
- // verify block statements start/end positions
- Iterator statements = block.statements().iterator();
- int idx = 0;
- while (statements.hasNext()) {
- node = (ExpressionStatement) statements.next();
- assumeEquals("Not a block", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); //$NON-NLS-1$
- ExpressionStatement statement = (ExpressionStatement) node;
- int statementStart = statement.getStartPosition();
- int statementEnd = statementStart + statement.getLength() - 1;
- if (idx < 2) {
- // Get comment range
- Comment comment = (Comment) compilUnit.getCommentList().get(idx);
- int commentStart = comment.getStartPosition();
- statementEnd = commentStart+comment.getLength()-1;
- }
- int extendedStart = compilUnit.getExtendedStartPosition(statement);
- assumeEquals("Statement "+statement+" does not start at the right position", statementStart, extendedStart);
- int extendedEnd = extendedStart + compilUnit.getExtendedLength(statement) - 1;
- assumeEquals("Statement "+statement+" does not end at the right position", statementEnd, extendedEnd);
- idx++;
- }
- }
- /** @deprecated using deprecated code */
- public void testBug55223b() throws JavaScriptModelException {
- sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug55223", "TestB.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit compilUnit = (JavaScriptUnit) result;
- assumeEquals(prefix+"Wrong number of problems", 0, compilUnit.getProblems().length); //$NON-NLS-1$
- assumeEquals(prefix+"Wrong number of comments", 2, compilUnit.getCommentList().size());
- // Get comment range
- Comment comment = (Comment) compilUnit.getCommentList().get(1);
- int commentStart = comment.getStartPosition();
- // get method
- ASTNode node = getASTNode(compilUnit, 0, 0);
- assumeNotNull("We should get a non-null ast node", node);
- assumeEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- FunctionDeclaration method = (FunctionDeclaration) node;
- // get return type
- node = method.getReturnType();
- assumeNotNull("We should get a non-null ast node", node);
- assumeTrue("Not return type", node.getNodeType() == ASTNode.SIMPLE_TYPE); //$NON-NLS-1$
- SimpleType returnType = (SimpleType) node;
- // verify that return type includes following comment
- int returnStart = compilUnit.getExtendedStartPosition(returnType);
- assumeEquals("Return type "+returnType+" does not start at the right position", commentStart, returnStart);
- int returnEnd = returnStart + compilUnit.getExtendedLength(returnType) - 1;
- assumeEquals("Return type "+returnType+" does not end at the right length", returnType.getStartPosition()+returnType.getLength()-1, returnEnd);
- }
- /*
- * End DefaultCommentMapper verifications
- */
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=48489"
- */
- public void testBug48489() throws JavaScriptModelException {
- verifyComments("testBug48489");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=50898"
- */
- public void testBug50898() throws JavaScriptModelException {
- IJavaScriptUnit unit = getCompilationUnit("Converter" , "src", "javadoc.testBug50898", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- packageBinding = false;
- verifyComments(unit);
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51226"
- */
- public void testBug51226() throws JavaScriptModelException {
- IJavaScriptUnit[] units = getCompilationUnits("Converter" , "src", "javadoc.testBug51226"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- for (int i=0; i<units.length; i++) {
- ASTNode result = runConversion(units[i], false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assumeEquals(prefix+"Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- assumeEquals(prefix+"Wrong number of comments", 1, unit.getCommentList().size());
- Comment comment = (Comment) unit.getCommentList().get(0);
- assumeTrue(prefix+"Comment should be a Javadoc one", comment.isDocComment());
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- JSdoc docComment = (JSdoc) comment;
- assumeEquals(prefix+"Wrong number of tags", 1, docComment.tags().size());
- TagElement tagElement = (TagElement) docComment.tags().get(0);
- assumeNull(prefix+"Wrong type of tag ["+tagElement+"]", tagElement.getTagName());
- assumeEquals(prefix+"Wrong number of fragments in tag ["+tagElement+"]", 1, tagElement.fragments().size());
- ASTNode fragment = (ASTNode) tagElement.fragments().get(0);
- assumeEquals(prefix+"Invalid type for fragment ["+fragment+"]", ASTNode.TEXT_ELEMENT, fragment.getNodeType());
- TextElement textElement = (TextElement) fragment;
- assumeEquals(prefix+"Invalid content for text element ", "Test", textElement.getText());
- if (debug) System.out.println(docComment+"\nsuccessfully verified.");
- }
- }
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51241"
- */
- public void testBug51241() throws JavaScriptModelException {
- verifyComments("testBug51241");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51363"
- */
- public void testBug51363() throws JavaScriptModelException {
- sourceUnit = getCompilationUnit("Converter" , "src", "javadoc.testBug51363", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assumeEquals(prefix+"Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- assumeEquals(prefix+"Wrong number of comments", 2, unit.getCommentList().size());
- // verify first comment
- Comment comment = (Comment) unit.getCommentList().get(0);
- assumeTrue(prefix+"Comment should be a line comment ", comment.isLineComment());
- String sourceStr = sourceUnit.getSource();
- int startPos = comment.getStartPosition()+comment.getLength();
- assumeEquals("Wrong length for line comment "+comment, "\\u000D\\u000A", sourceStr.substring(startPos, startPos+12));
- if (debug) System.out.println(comment+"\nsuccessfully verified.");
- // verify second comment
- comment = (Comment) unit.getCommentList().get(1);
- assumeTrue(prefix+"Comment should be a line comment", comment.isLineComment());
- sourceStr = sourceUnit.getSource();
- startPos = comment.getStartPosition()+comment.getLength();
- assumeEquals("Wrong length for line comment "+comment, "\\u000Dvoid", sourceStr.substring(startPos, startPos+10));
- if (debug) System.out.println(comment+"\nsuccessfully verified.");
-// verifyComments("testBug51363");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51476"
- */
- public void testBug51476() throws JavaScriptModelException {
- verifyComments("testBug51476");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51478"
- */
- public void testBug51478() throws JavaScriptModelException {
- verifyComments("testBug51478");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51508"
- */
- public void testBug51508() throws JavaScriptModelException {
- verifyComments("testBug51508");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51650"
- */
- public void testBug51650() throws JavaScriptModelException {
- verifyComments("testBug51650");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51770"
- */
- public void testBug51770() throws JavaScriptModelException {
- verifyComments("testBug51770");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=52908"
- */
- public void testBug52908() throws JavaScriptModelException {
- verifyComments("testBug52908");
- }
- public void testBug52908a() throws JavaScriptModelException {
- verifyComments("testBug52908a");
- }
- public void testBug52908unicode() throws JavaScriptModelException {
- verifyComments("testBug52908unicode");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=53276"
- */
- public void testBug53276() throws JavaScriptModelException {
- verifyComments("testBug53276");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=53075"
- */
- public void testBug53075() throws JavaScriptModelException {
- IJavaScriptUnit unit = getCompilationUnit("Converter" , "src", "javadoc.testBug53075", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- boolean pb = packageBinding;
- packageBinding = false;
- JavaScriptUnit compilUnit = verifyComments(unit);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- Comment comment = (Comment) compilUnit.getCommentList().get(0);
- assumeTrue(prefix+"Comment should be a javadoc comment ", comment.isDocComment());
- JSdoc docComment = (JSdoc) comment;
- TagElement tagElement = (TagElement) docComment.tags().get(0);
- assumeEquals("Wrong tag type!", TagElement.TAG_LINK, tagElement.getTagName());
- tagElement = (TagElement) docComment.tags().get(1);
- assumeEquals("Wrong tag type!", TagElement.TAG_LINKPLAIN, tagElement.getTagName());
- }
- packageBinding = pb;
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=53757"
- */
- public void testBug53757() throws JavaScriptModelException {
- verifyComments("testBug53757");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51600"
- */
- public void testBug51600() throws JavaScriptModelException {
- verifyComments("testBug51600");
- }
- public void testBug51617() throws JavaScriptModelException {
- stopOnFailure = false;
- String [] unbound = { "e" };
- verifyComments("testBug51617");
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- int size = unbound.length;
- for (int i=0, f=0; i<size; i++) {
- assertTrue("Invalid number of failures!", failures.size()>f);
- String failure = (String) failures.get(f);
- String expected = "Reference '"+unbound[i]+"' should be bound!";
- if (expected.equals(failure.substring(failure.indexOf(' ')+1))) {
- failures.remove(f);
- } else {
- f++; // skip offending failure
- i--; // stay on expected string
- }
- }
- }
- stopOnFailure = true;
- }
- public void testBug54424() throws JavaScriptModelException {
- stopOnFailure = false;
- String [] unbound = { "tho",
- "from",
- "A#getList(int,long,boolean)",
- "#getList(Object,java.util.AbstractList)",
- "from",
- "#getList(int from,long tho)",
- "to"
- };
- verifyComments("testBug54424");
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- int size = unbound.length;
- for (int i=0, f=0; i<size; i++) {
- assertTrue("Invalid number of failures!", failures.size()>f);
- String failure = (String) failures.get(f);
- String expected = "Reference '"+unbound[i]+"' should be bound!";
- if (expected.equals(failure.substring(failure.indexOf(' ')+1))) {
- failures.remove(f);
- } else {
- f++; // skip offending failure
- i--; // stay on expected string
- }
- }
- }
- stopOnFailure = true;
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=63044"
- */
- public void testBug63044() throws JavaScriptModelException {
- verifyComments("testBug63044");
- }
-
- /**
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=51660"
- */
- public void testBug51660() throws JavaScriptModelException {
- stopOnFailure = false;
- IJavaScriptUnit unit = getCompilationUnit("Converter" , "src", "javadoc.testBug51660", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit compilUnit = verifyComments(unit);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- String[] tagNames = {
- "@ejb",
- "@ejb",
- "@ejb",
- "@ejb",
- "@ejb",
- "@ejb",
- "@ejb(bean",
- "@ejb)bean",
- "@ejb",
- "@ejb+bean",
- "@ejb,bean",
- "@ejb-bean",
- "@ejb.bean",
- "@ejb/bean",
- "@ejb",
- "@ejb;bean",
- "@ejb",
- "@ejb=bean",
- "@ejb",
- "@ejb?bean",
- "@ejb@bean",
- "@ejb[bean",
- "@ejb\\bean",
- "@ejb]bean",
- "@ejb^bean",
- "@ejb`bean",
- "@ejb{bean",
- "@ejb|bean",
- "@ejb",
- "@ejb~bean",
- "@unknown"
- };
- String[] tagTexts = {
- "!bean test non-java id character '!' (val=33) in tag name",
- "\"bean test non-java id character '\"' (val=34) in tag name",
- "#bean test non-java id character '#' (val=35) in tag name",
- "%bean test non-java id character '%' (val=37) in tag name",
- "&bean test non-java id character '&' (val=38) in tag name",
- "'bean test non-java id character ''' (val=39) in tag name",
- " test non-java id character '(' (val=40) in tag name",
- " test non-java id character ')' (val=41) in tag name",
- "*bean test non-java id character '*' (val=42) in tag name",
- " test non-java id character '+' (val=43) in tag name",
- " test non-java id character ',' (val=44) in tag name",
- " test non-java id character '-' (val=45) in tag name",
- " test non-java id character '.' (val=46) in tag name",
- " test non-java id character '/' (val=47) in tag name",
- ":bean test non-java id character ':' (val=58) in tag name",
- " test non-java id character ';' (val=59) in tag name",
- "<bean test non-java id character '<' (val=60) in tag name",
- " test non-java id character '=' (val=61) in tag name",
- ">bean test non-java id character '>' (val=62) in tag name",
- " test non-java id character '?' (val=63) in tag name",
- " test non-java id character '@' (val=64) in tag name",
- " test non-java id character '[' (val=91) in tag name",
- " test non-java id character '\\' (val=92) in tag name",
- " test non-java id character ']' (val=93) in tag name",
- " test non-java id character '^' (val=94) in tag name",
- " test non-java id character '`' (val=96) in tag name",
- " test non-java id character '{' (val=123) in tag name",
- " test non-java id character '|' (val=124) in tag name",
- "}bean test non-java id character '}' (val=125) in tag name",
- " test non-java id character '~' (val=126) in tag name",
- " test java id"
- };
- Comment comment = (Comment) compilUnit.getCommentList().get(0);
- assumeTrue(prefix+"Comment should be a javadoc comment ", comment.isDocComment());
- JSdoc docComment = (JSdoc) comment;
- int size = docComment.tags().size();
- for (int i=0; i<size; i++) {
- TagElement tagElement = (TagElement) docComment.tags().get(i);
- assumeEquals("Wrong tag name for:"+tagElement, tagNames[i], tagElement.getTagName());
- assumeEquals("Wrong fragments size for :"+tagElement, 1, tagElement.fragments().size());
- ASTNode fragment = (ASTNode) tagElement.fragments().get(0);
- assumeEquals("Wrong fragments type for :"+tagElement, ASTNode.TEXT_ELEMENT, fragment.getNodeType());
- TextElement textElement = (TextElement) fragment;
- assumeEquals("Wrong text for tag!", tagTexts[i], textElement.getText());
- }
- }
- stopOnFailure = true;
- }
-
- /**
- * Bug 65174: Spurious "Javadoc: Missing reference" error
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=65174"
- */
- public void testBug65174() throws JavaScriptModelException {
- verifyComments("testBug65174");
- }
-
- /**
- * Bug 65253: [Javadoc] @@tag is wrongly parsed as @tag
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=65253"
- */
- public void testBug65253() throws JavaScriptModelException {
- verifyComments("testBug65253");
- }
-
- /**
- * Bug 65288: Javadoc: tag gets mangled when javadoc closing on same line without whitespace
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=65288"
- */
- public void testBug65288() throws JavaScriptModelException {
- verifyComments("testBug65288");
- }
-
- /**
- * Bug 68017: Javadoc processing does not detect missing argument to @return
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=68017"
- */
- public void testBug68017() throws JavaScriptModelException {
- verifyComments("testBug68017");
- }
-
- /**
- * Bug 68025: Javadoc processing does not detect some wrong links
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=68025"
- */
- public void testBug68025() throws JavaScriptModelException {
- verifyComments("testBug68025");
- }
-
- /**
- * Bug 69272: [Javadoc] Invalid malformed reference (missing separator)
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=69272"
- */
- public void testBug69272() throws JavaScriptModelException {
- verifyComments("testBug69272");
- }
-
- /**
- * Bug 69275: [Javadoc] Invalid warning on @see link
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=69275"
- */
- public void testBug69275() throws JavaScriptModelException {
- verifyComments("testBug69275");
- }
-
- /**
- * Bug 69302: [Javadoc] Invalid reference warning inconsistent with javadoc tool
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=69302"
- */
- public void testBug69302() throws JavaScriptModelException {
- verifyComments("testBug69302");
- }
-
- /**
- * Bug 68726: [Javadoc] Target attribute in @see link triggers warning
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=68726"
- */
- public void testBug68726() throws JavaScriptModelException {
- verifyComments("testBug68726");
- }
-
- /**
- * Bug 70892: [1.5][Javadoc] Compiler should parse reference for inline tag @value
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=70892"
- * @deprecated using deprecated code
- */
- public void testBug70892_JLS2() throws JavaScriptModelException {
- int level = astLevel;
- astLevel = AST.JLS2;
- verifyComments("testBug70892");
- astLevel = level;
- }
- public void testBug70892_JLS3() throws JavaScriptModelException {
- int level = astLevel;
- astLevel = AST.JLS3;
- verifyComments("testBug70892");
- astLevel = level;
- }
-
- /**
- * Bug 51911: [Javadoc] @see method w/out ()
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=51911"
- */
- public void testBug51911() throws JavaScriptModelException {
- verifyComments("testBug51911");
- }
-
- /**
- * Bug 73348: [Javadoc] Missing description for return tag is not always warned
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=73348"
- */
- public void testBug73348() throws JavaScriptModelException {
- verifyComments("testBug73348");
- }
-
- /**
- * Bug 77644: [dom] AST node extended positions may be wrong while moving
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=77644"
- */
- public void testBug77644() throws JavaScriptModelException {
- verifyComments("testBug77644");
- }
-
- /**
- * Bug 79809: [1.5][dom][javadoc] Need better support for type parameter Javadoc tags
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=79809"
- */
- public void testBug79809() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter/src/javadoc/b79809/Test.js",
- "package javadoc.b79809;\n" +
- "/**\n" +
- " * @param <E> Class type parameter\n" +
- " * @see Object\n" +
- " */\n" +
- "public class Test<E> {\n" +
- " /**\n" +
- " * @param t\n" +
- " * @param <T> Method type parameter\n" +
- " */\n" +
- " <T> void foo(T t) {}\n" +
- "}\n");
- verifyWorkingCopiesComments();
- }
- public void testBug79809b() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter/src/javadoc/b79809/Test.js",
- "package javadoc.b79809;\n" +
- "\n" +
- "/**\n" +
- " * New tags for 5.0\n" +
- " * - literal: {@literal a<B>c}\n" +
- " * - code: {@code abc}\n" +
- " * - value: {@value System#out}\n" +
- " */\n" +
- "public class Test {\n" +
- "\n" +
- "}\n");
- verifyWorkingCopiesComments();
- }
-
- /**
- * Bug 79904: [1.5][dom][javadoc] TagElement range not complete for type parameter tags
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=79904"
- */
- public void testBug79904() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter/src/javadoc/b79904/Test.js",
- "package javadoc.b79904;\n" +
- "/**\n" +
- " * @param <E>\n" +
- " * @see Object\n" +
- " */\n" +
- "public class Test<E> {\n" +
- " /**\n" +
- " * @param t\n" +
- " * @param <T>\n" +
- " */\n" +
- " <T> void foo(T t) {}\n" +
- "}\n");
- verifyWorkingCopiesComments();
- }
-
- /**
- * Bug 80221: [1.5][dom][javadoc] Need better support for type parameter Javadoc tags
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=80221"
- */
- public void testBug80221() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter/src/javadoc/b80221/Test.js",
- "package javadoc.b80221;\n" +
- "public class Test {\n" +
- " /**\n" +
- " * @see Object Unknown: ref is not resolved due to compile error...\n" +
- " */\n" +
- " public foo() {\n" +
- " return 1;\n" +
- " }\n" +
- "}\n"
- );
- verifyWorkingCopiesComments();
- }
-
- /**
- * Bug 80257: [1.5][javadoc][dom] Type references in javadocs should have generic binding, not raw
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=80257"
- */
- public void testBug80257() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b80257/Test.js",
- "package javadoc.b80257;\n" +
- "import java.util.*;\n" +
- "public class Test {\n" +
- " /**\n" +
- " * @see ArrayList\n" +
- " * @return {@link java.util.List}\n" +
- " */\n" +
- " List<String> getList() {\n" +
- " return new ArrayList<String>();\n" +
- " }\n" +
- "}\n"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Do not need to verify following statement as we know it's ok as verifyComments did not fail
- JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // get javadoc comment
- TagElement firstTag = (TagElement) docComment.tags().get(0); // get first tag
- TagElement secondTag = (TagElement) docComment.tags().get(1); // get second tag
- TagElement inlineTag = (TagElement) secondTag.fragments().get(1); // get inline tag
- // Get tag simple name reference in first tag
- assertEquals("Invalid number of fragments for tag element: "+firstTag, 1, firstTag.fragments().size());
- ASTNode node = (ASTNode) firstTag.fragments().get(0);
- assertEquals("Invalid kind of name reference for tag element: "+firstTag, ASTNode.SIMPLE_NAME, node.getNodeType());
- SimpleName seeRef = (SimpleName) node;
- // Verify binding for simple name
- IBinding binding = seeRef.resolveBinding();
- assertTrue("Wrong kind of binding", binding instanceof ITypeBinding);
- // Get inline tag simple name reference in second tag
- assertEquals("Invalid number of fragments for inline tag element: "+inlineTag, 1, inlineTag.fragments().size());
- node = (ASTNode) inlineTag.fragments().get(0);
- assertEquals("Invalid kind of name reference for tag element: "+inlineTag, ASTNode.QUALIFIED_NAME, node.getNodeType());
- QualifiedName linkRef = (QualifiedName) node;
- // Verify binding for qualified name
- binding = linkRef.resolveBinding();
- assertTrue("Wrong kind of binding", binding instanceof ITypeBinding);
- }
- }
-
- /**
- * Bug 83804: [1.5][javadoc] Missing Javadoc node for package declaration
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=83804"
- */
- public void testBug83804() throws CoreException, JavaScriptModelException {
- astLevel = AST.JLS3;
- workingCopies = new IJavaScriptUnit[2];
- workingCopies[0] = getCompilationUnit("Converter15", "src", "javadoc.b83804", "package-info.js");
- workingCopies[1] = getCompilationUnit("Converter15", "src", "javadoc.b83804", "Test.js");
- verifyWorkingCopiesComments();
- }
- public void testBug83804a() throws CoreException, JavaScriptModelException {
- astLevel = AST.JLS3;
- workingCopies = new IJavaScriptUnit[2];
- workingCopies[0] = getCompilationUnit("Converter15", "src", "javadoc.b83804a", "package-info.js");
- workingCopies[1] = getCompilationUnit("Converter15", "src", "javadoc.b83804a", "Test.js");
- verifyWorkingCopiesComments();
- }
-
- /**
- * Bug 84049: [javadoc][dom] Extended ranges wrong for method name without return type
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=84049"
- */
- public void testBug84049() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b84049/Test.js",
- "package javadoc.b84049;\n" +
- "public class Test {\n" +
- " /**\n" +
- " * @see Object\n" +
- " */\n" +
- " foo() {\n" +
- " }\n" +
- "}\n"
- );
- JavaScriptUnit compilUnit = (JavaScriptUnit) runConversion(workingCopies[0], true);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- ASTNode node = getASTNode(compilUnit, 0, 0);
- assertEquals("Invalid type for node: "+node, ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- JSdoc methodJavadoc = methodDeclaration.getJavadoc();
- assertNotNull("FunctionDeclaration have a javadoc comment", methodJavadoc);
- int javadocStart = methodJavadoc.getStartPosition();
- assertEquals("Method declaration should include javadoc comment", methodDeclaration.getStartPosition(), javadocStart);
- SimpleName methodName = methodDeclaration.getName();
- int nameStart = methodName.getStartPosition();
- assertTrue("Method simple name should not include javadoc comment", nameStart > javadocStart+methodJavadoc.getLength());
- int extendedStart = compilUnit.getExtendedStartPosition(methodName);
- assertEquals("Method simple name start position should not be extended!", nameStart, extendedStart);
- int extendedLength = compilUnit.getExtendedLength(methodName);
- assertEquals("Method simple name length should not be extended!", methodName.getLength(), extendedLength);
- }
- }
-
- /**
- * Bug 87845: [1.5][javadoc][dom] Type references in javadocs should have generic binding, not raw
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=87845"
- */
- public void testBug87845() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b87845/Test.js",
- "package javadoc.b87845;\n" +
- "public class Test {\n" +
- " public void foo(int a, int b) {} \n" +
- " public void foo(int a, int... args) {}\n" +
- " public void foo(String... args) {}\n" +
- " public void foo(Exception str, boolean... args) {}\n" +
- " /**\n" +
- " * @see Test#foo(int, int)\n" +
- " * @see Test#foo(int, int[])\n" +
- " * @see Test#foo(int, int...)\n" +
- " * @see Test#foo(String[])\n" +
- " * @see Test#foo(String...)\n" +
- " * @see Test#foo(Exception, boolean[])\n" +
- " * @see Test#foo(Exception, boolean...)\n" +
- " */\n" +
- " public void valid() {}\n" +
- " /**\n" +
- " * @see Test#foo(int)\n" +
- " * @see Test#foo(int, int, int)\n" +
- " * @see Test#foo()\n" +
- " * @see Test#foo(String)\n" +
- " * @see Test#foo(String, String)\n" +
- " * @see Test#foo(Exception)\n" +
- " * @see Test#foo(Exception, boolean)\n" +
- " * @see Test#foo(Exception, boolean, boolean)\n" +
- " */\n" +
- " public void invalid() {}\n" +
- "}\n"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Do not need to verify following statement as we know it's ok as verifyComments did not fail
- JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // get first javadoc comment
- // Verify last parameter for all methods reference in javadoc comment
- List tags = docComment.tags();
- int size = tags.size();
- for (int i=0; i<size; i++) {
- TagElement tag = (TagElement) docComment.tags().get(i);
- assertEquals("Invalid number of fragment for see reference: "+tag, 1, tag.fragments().size());
- ASTNode node = (ASTNode) tag.fragments().get(0);
- assertEquals("Invalid kind of name reference for tag element: "+tag, ASTNode.FUNCTION_REF, node.getNodeType());
- FunctionRef methodRef = (FunctionRef) node;
- List parameters = methodRef.parameters();
- int paramSize = parameters.size();
- for (int j=0; j<paramSize; j++) {
- node = (ASTNode) parameters.get(j);
- assertEquals("Invalid kind of method parameter: "+node, ASTNode.FUNCTION_REF_PARAMETER, node.getNodeType());
- FunctionRefParameter parameter = (FunctionRefParameter) node;
- if (j==(paramSize-1)) {
- switch (i) {
- case 2:
- case 4:
- case 6:
- assertTrue("Method parameter \""+parameter+"\" should be varargs!", parameter.isVarargs());
- break;
- default:
- assertFalse("Method parameter \""+parameter+"\" should not be varargs!", parameter.isVarargs());
- break;
- }
- } else {
- assertFalse("Method parameter \""+parameter+"\" should not be varargs!", parameter.isVarargs());
- }
- }
- }
- }
- }
-
- /**
- * Bug 93880: [1.5][javadoc] Source range of PackageDeclaration does not include Javadoc child
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=93880"
- */
- public void testBug93880_15a() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/Test.js",
- "/**\n" +
- " * Javadoc\n" +
- " */\n" +
- "package javadoc.b93880;\n" +
- "public class Test {\n" +
- "}\n"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Get package declaration declaration and javadoc
- PackageDeclaration packDecl = compilUnit.getPackage();
- JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail
-
- // Verify package declaration javadoc
- assertTrue("Javadoc should be set on package declaration", docComment == packDecl.getJavadoc());
-
- // Verify package declaration declaration source start
- assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition());
- }
- }
- public void testBug93880_15b() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.js",
- "/**\n" +
- " * Javadoc for all package\n" +
- " */\n" +
- "package javadoc.b93880;"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Get package declaration declaration and javadoc
- PackageDeclaration packDecl = compilUnit.getPackage();
- JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail
-
- // Verify package declaration javadoc
- assertTrue("Javadoc should be set on package declaration", docComment == packDecl.getJavadoc());
-
- // Verify package declaration declaration source start
- assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition());
- }
- }
- public void testBug93880_15c() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.js",
- "/**\n" +
- " * Javadoc for all package\n" +
- " */\n" +
- "private package javadoc.b93880;"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Get package declaration declaration and javadoc
- PackageDeclaration packDecl = compilUnit.getPackage();
- JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail
-
- // Verify package declaration javadoc
- assertTrue("Javadoc should be set on package declaration", docComment == packDecl.getJavadoc());
-
- // Verify package declaration declaration source start
- assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition());
- }
- }
- public void testBug93880_15d() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.js",
- "/**\n" +
- " * Javadoc for all package\n" +
- " */\n" +
- "@Deprecated\n" +
- "package javadoc.b93880;"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Get package declaration declaration and javadoc
- PackageDeclaration packDecl = compilUnit.getPackage();
- assertNotNull("Compilation unit should have a package declaration", packDecl);
- JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail
-
- // Verify package declaration javadoc
- assertTrue("Javadoc should be set on package declaration", docComment == packDecl.getJavadoc());
-
- // Verify package declaration declaration source start
- assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition());
- }
- }
- public void testBug93880_15e() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.js",
- "/* (non-javadoc)\n" +
- " * No comment\n" +
- " */\n" +
- "package javadoc.b93880;"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Get package declaration declaration and javadoc
- PackageDeclaration packDecl = compilUnit.getPackage();
- List unitComments = compilUnit.getCommentList();
- assertEquals("Wrong number of comments", 1, unitComments.size());
- Comment comment = (Comment) unitComments.get(0);
-
- // Verify package declaration javadoc
- assertNull("Package declaration should not have any javadoc", packDecl.getJavadoc());
-
- // Verify package declaration declaration source start
- assertTrue("Source range of PackageDeclaration should NOT include Javadoc child", packDecl.getStartPosition() > comment.getStartPosition()+comment.getLength());
- }
- }
- public void testBug93880_14a() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/Test.js",
- "/**\n" +
- " * Javadoc\n" +
- " */\n" +
- "package javadoc.b93880;\n" +
- "public class Test {\n" +
- "}\n"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Get package declaration declaration and javadoc
- PackageDeclaration packDecl = compilUnit.getPackage();
- JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail
-
- // Verify package declaration declaration source start
- assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition());
- }
- }
- public void testBug93880_14b() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.js",
- "/**\n" +
- " * Javadoc for all package\n" +
- " */\n" +
- "package javadoc.b93880;"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Get package declaration declaration and javadoc
- PackageDeclaration packDecl = compilUnit.getPackage();
- JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail
-
- // Verify package declaration declaration source start
- assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition());
- }
- }
- public void testBug93880_14c() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.js",
- "/**\n" +
- " * Javadoc for all package\n" +
- " */\n" +
- "private package javadoc.b93880;"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Get package declaration declaration and javadoc
- PackageDeclaration packDecl = compilUnit.getPackage();
- JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail
-
- // Verify package declaration declaration source start
- assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition());
- }
- }
- public void testBug93880_14d() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.js",
- "/**\n" +
- " * Javadoc for all package\n" +
- " */\n" +
- "@Deprecated\n" +
- "package javadoc.b93880;"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Get package declaration declaration and javadoc
- PackageDeclaration packDecl = compilUnit.getPackage();
- assertNotNull("Compilation unit should have a package declaration", packDecl);
- JSdoc docComment = (JSdoc) compilUnit.getCommentList().get(0); // Do not need to verify following statement as we know it's ok as verifyComments did not fail
-
- // Verify package declaration declaration source start
- assertEquals("Source range of PackageDeclaration should include Javadoc child", docComment.getStartPosition(), packDecl.getStartPosition());
- }
- }
- public void testBug93880_14e() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b93880/package-info.js",
- "/* (non-javadoc)\n" +
- " * No comment\n" +
- " */\n" +
- "package javadoc.b93880;"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Get package declaration declaration and javadoc
- PackageDeclaration packDecl = compilUnit.getPackage();
- List unitComments = compilUnit.getCommentList();
- assertEquals("Wrong number of comments", 1, unitComments.size());
- Comment comment = (Comment) unitComments.get(0);
-
- // Verify package declaration declaration source start
- assertTrue("Source range of PackageDeclaration should NOT not include Javadoc child", packDecl.getStartPosition() > comment.getStartPosition()+comment.getLength());
- }
- }
-
-
- /**
- * Bug 99507: [javadoc] Infinit loop in DocCommentParser
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=99507"
- */
- public void testBug99507() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b99507/X.js",
- "package javadoc.b99507;\n" +
- "public class X {\n" +
- "}\n" +
- "/** @param test*/"
- );
- verifyComments(workingCopies[0]);
- }
- public void testBug99507b() throws JavaScriptModelException {
- String source = "/**\n@param country*/";
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind(ASTParser.K_COMPILATION_UNIT);
- parser.setSource(source.toCharArray());
- parser.createAST(null);
- }
-
- /**
- * Bug 100041: [javadoc] Infinit loop in DocCommentParser
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=100041"
- */
- public void testBug100041() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b100041/X.js",
- "package javadoc.b100041;\n" +
- "class X {\n" +
- " static Object object;\n" +
- " static void foo() {\n" +
- " /**\n" +
- " * javadoc comment.\n" +
- " */\n" +
- " if (object instanceof String) {\n" +
- " final String clr = null;\n" +
- " }\n" +
- " }\n" +
- "}"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Get comment
- List unitComments = compilUnit.getCommentList();
- assertEquals("Wrong number of comments", 1, unitComments.size());
- Comment comment = (Comment) unitComments.get(0);
- int commentStart = comment.getStartPosition();
- int commentEnd = commentStart+comment.getLength();
-
- // Get local variable declaration
- ASTNode node = getASTNode(compilUnit, 0, 1, 0);
- assertEquals("Expected if statement for node: "+node, ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- assertTrue("Invalid start position for IfStatement: "+ifStatement, ifStatement.getStartPosition() > commentEnd);
- Statement statement = ifStatement.getThenStatement();
- assertEquals("Expected block for node: "+statement, ASTNode.BLOCK, statement.getNodeType());
- Block block = (Block) statement;
- assertTrue("Invalid start position for Block: "+block, block.getStartPosition() > commentEnd);
- List statements = block.statements();
- assertEquals("Invalid number of statements for block: "+block, 1, statements.size());
- statement = (Statement) statements.get(0);
- assertEquals("Expected variable declaration statement for node: "+statement, ASTNode.VARIABLE_DECLARATION_STATEMENT, statement.getNodeType());
- VariableDeclarationStatement varDecl = (VariableDeclarationStatement) statement;
- assertTrue("Invalid start position for : VariableDeclarationStatement"+varDecl, varDecl.getStartPosition() > commentEnd);
- }
- }
- public void testBug100041b() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b100041/X.js",
- "package javadoc.b100041;\n" +
- "class X {\n" +
- " static Object object;\n" +
- " static void foo() {\n" +
- " /**\n" +
- " * javadoc comment.\n" +
- " */\n" +
- " if (object instanceof String)\n" +
- " return;\n" +
- " }\n" +
- "}"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Get comment
- List unitComments = compilUnit.getCommentList();
- assertEquals("Wrong number of comments", 1, unitComments.size());
- Comment comment = (Comment) unitComments.get(0);
- int commentStart = comment.getStartPosition();
- int commentEnd = commentStart+comment.getLength();
-
- // Get local variable declaration
- ASTNode node = getASTNode(compilUnit, 0, 1, 0);
- assertEquals("Expected if statement for node: "+node, ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- assertTrue("Invalid start position for IfStatement: "+ifStatement, ifStatement.getStartPosition() > commentEnd);
- Statement statement = ifStatement.getThenStatement();
- assertEquals("Expected block for node: "+statement, ASTNode.RETURN_STATEMENT, statement.getNodeType());
- ReturnStatement returnStatement = (ReturnStatement) statement;
- assertTrue("Invalid start position for Block: "+returnStatement, returnStatement.getStartPosition() > commentEnd);
- }
- }
- public void testBug100041c() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b100041/Z.js",
- "package javadoc.b100041;\n" +
- "public class Z {\n" +
- " /** C1 */\n" +
- " class Z1 {}\n" +
- " /** C2 */\n" +
- " Z1 z1;\n" +
- " /** C3 */\n" +
- " public static void foo(Object object) {\n" +
- " /** C4 */\n" +
- " class ZZ {\n" +
- " /** C5 */\n" +
- " ZZ zz;\n" +
- " /** C6 */\n" +
- " public void bar() {}\n" +
- " }\n" +
- " }\n" +
- "}\n"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Get comments
- List unitComments = compilUnit.getCommentList();
- int size = unitComments.size();
- assertEquals("Wrong number of comments", 6, size);
- JSdoc[] javadocs = new JSdoc[size];
- Iterator iterator = unitComments.iterator();
- for (int i=0; i<size; i++) {
- Comment comment = (Comment) iterator.next();
- assertEquals("Expect javadoc for comment: "+comment, ASTNode.JSDOC, comment.getNodeType());
- javadocs[i] = (JSdoc) comment;
- }
-
- // Verify member type declaration start
- ASTNode node = getASTNode(compilUnit, 0, 0);
- assertEquals("Expected type declaration for node: "+node, ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- int javadocStart = javadocs[0].getStartPosition();
- assertEquals("Invalid start position for TypeDeclaration: "+typeDeclaration, typeDeclaration.getStartPosition(), javadocStart);
-
- // Verify field declaration start
- node = getASTNode(compilUnit, 0, 1);
- assertEquals("Expected field declaration for node: "+node, ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- javadocStart = javadocs[1].getStartPosition();
- assertEquals("Invalid start position for FieldDeclaration: "+fieldDeclaration, fieldDeclaration.getStartPosition(), javadocStart);
-
- // Verify method declaration start
- node = getASTNode(compilUnit, 0, 2);
- assertEquals("Expected method declaration for node: "+node, ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- javadocStart = javadocs[2].getStartPosition();
- assertEquals("Invalid start position for FunctionDeclaration: "+methodDeclaration, methodDeclaration.getStartPosition(), javadocStart);
-
- // Verify local type declaration start
- node = getASTNode(compilUnit, 0, 2, 0);
- assertEquals("Expected type declaration for node: "+node, ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType());
- typeDeclaration = (TypeDeclaration) ((TypeDeclarationStatement) node).getDeclaration();
- javadocStart = javadocs[3].getStartPosition();
- assertEquals("Invalid start position for TypeDeclaration: "+typeDeclaration, typeDeclaration.getStartPosition(), javadocStart);
-
- // Verify field declaration start
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- node = (ASTNode) bodyDeclarations.get(0);
- assertEquals("Expected field declaration for node: "+node, ASTNode.FIELD_DECLARATION, node.getNodeType());
- fieldDeclaration = (FieldDeclaration) node;
- javadocStart = javadocs[4].getStartPosition();
- assertEquals("Invalid start position for FieldDeclaration: "+fieldDeclaration, fieldDeclaration.getStartPosition(), javadocStart);
-
- // Verify method declaration start
- node = (ASTNode) bodyDeclarations.get(1);
- assertEquals("Expected method declaration for node: "+node, ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- methodDeclaration = (FunctionDeclaration) node;
- javadocStart = javadocs[5].getStartPosition();
- assertEquals("Invalid start position for FunctionDeclaration: "+methodDeclaration, methodDeclaration.getStartPosition(), javadocStart);
- }
- }
-
- /**
- * @bug 103304: [Javadoc] Wrong reference proposal for inner classes.
- * @see "http://bugs.eclipse.org/bugs/show_bug.cgi?id=103304"
- */
- public void testBug103304() throws JavaScriptModelException {
- this.packageBinding = false; // do NOT verify that qualification only can be package name
- workingCopies = new IJavaScriptUnit[1];
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b103304/Test.js",
- "package javadoc.b103304;\n" +
- "interface IAFAState {\n" +
- " public class ValidationException extends Exception {\n" +
- " public ValidationException(String variableName, IAFAState subformula) {\n" +
- " super(\"Variable \'\"+variableName+\"\' may be unbound in \'\"+subformula+\"\'\");\n" +
- " }\n" +
- " }\n" +
- "}\n" +
- "public class Test {\n" +
- " /**\n" +
- " * @see IAFAState.ValidationException#IAFAState.ValidationException(String, IAFAState)\n" +
- " */\n" +
- " IAFAState.ValidationException valid;\n" +
- "}\n"
- );
- JavaScriptUnit compilUnit = (JavaScriptUnit) runConversion(workingCopies[0], true);
- verifyWorkingCopiesComments();
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Verify comment type
- Iterator unitComments = compilUnit.getCommentList().iterator();
- while (unitComments.hasNext()) {
- Comment comment = (Comment) unitComments.next();
- assertEquals("Comment should be javadoc", comment.getNodeType(), ASTNode.JSDOC);
- JSdoc javadoc = (JSdoc) comment;
-
- // Verify that there's always a method reference in tags
- List tags = javadoc.tags();
- int size = tags.size();
- for (int i=0; i<size; i++) {
- TagElement tag = (TagElement) javadoc.tags().get(i);
- assertEquals("Invalid number of fragment for see reference: "+tag, 1, tag.fragments().size());
- ASTNode node = (ASTNode) tag.fragments().get(0);
- assertEquals("Invalid kind of name reference for tag element: "+tag, ASTNode.FUNCTION_REF, node.getNodeType());
- }
- }
- }
- }
-
- /**
- * Bug 106581: [javadoc] null type binding for parameter in javadoc
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=106581"
- */
- public void testBug106581() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b106581/A.js",
- "package javadoc.b106581;\n" +
- "public class A {\n" +
- " /**\n" +
- " * @param x\n" +
- " */ \n" +
- " public void foo(int x) {},\n" +
- "}\n"
- );
- JavaScriptUnit compilUnit = verifyComments(workingCopies[0]);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Get comment
- List unitComments = compilUnit.getCommentList();
- assertEquals("Wrong number of comments", 1, unitComments.size());
- Comment comment = (Comment) unitComments.get(0);
- assertEquals("Comment should be javadoc", comment.getNodeType(), ASTNode.JSDOC);
-
- // Get local variable declaration
- JSdoc docComment = (JSdoc) comment;
- TagElement tag = (TagElement) docComment.tags().get(0);
- assertEquals("Invalid number of fragment for tag: "+tag, 1, tag.fragments().size());
- ASTNode node = (ASTNode) tag.fragments().get(0);
- assertEquals("Invalid kind of name reference for tag element: "+tag, ASTNode.SIMPLE_NAME, node.getNodeType());
- SimpleName simpleName = (SimpleName) node;
- assertNotNull("We should have a type binding for simple name: "+simpleName, simpleName.resolveTypeBinding());
- }
- }
-
- /**
- * Bug 108622: [javadoc][dom] ASTNode not including javadoc
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=108622"
- */
- public void testBug108622() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b108622/Test.js",
- "package javadoc.b108622;\n" +
- "/**\n" +
- " * \n" +
- " */\n" +
- "public abstract class Test {\n" +
- "\n" +
- " /**\n" +
- " * \n" +
- " */\n" +
- " public abstract Zork getFoo();\n" +
- "\n" +
- " /**\n" +
- " * \n" +
- " */\n" +
- " public abstract void setFoo(Zork dept);\n" +
- "\n" +
- "}"
- );
- JavaScriptUnit compilUnit = (JavaScriptUnit) runConversion(workingCopies[0], true);
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Verify first method
- ASTNode node = getASTNode(compilUnit, 0, 0);
- assertEquals("Invalid type for node: "+node, ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("Invalid method name", "getFoo", methodDeclaration.getName().toString());
- JSdoc methodJavadoc = methodDeclaration.getJavadoc();
- assertNotNull("FunctionDeclaration have a javadoc comment", methodJavadoc);
- int javadocStart = methodJavadoc.getStartPosition();
- assertEquals("Method declaration should include javadoc comment", methodDeclaration.getStartPosition(), javadocStart);
- // Verify second method
- node = getASTNode(compilUnit, 0, 1);
- assertEquals("Invalid type for node: "+node, ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- methodDeclaration = (FunctionDeclaration) node;
- assertEquals("Invalid method name", "setFoo", methodDeclaration.getName().toString());
- methodJavadoc = methodDeclaration.getJavadoc();
- assertNotNull("FunctionDeclaration have a javadoc comment", methodJavadoc);
- javadocStart = methodJavadoc.getStartPosition();
- assertEquals("Method declaration should include javadoc comment", methodDeclaration.getStartPosition(), javadocStart);
- }
- }
-
- /**
- * Bug 113108: [API][comments] JavaScriptUnit.getNodeComments(ASTNode)
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=113108"
- */
- public void testBug113108a() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b113108/Test.js",
- "package javadoc.b113108;\n" +
- "/** C0 */\n" +
- "public class Test {\n" +
- " /* C1 */\n" +
- " /** C2 */\n" +
- " // C3\n" +
- " public void foo() {\n" +
- " /* C4 */\n" +
- " }\n" +
- " /* C5 */\n" +
- " /** C6 */\n" +
- " // C7\n" +
- "}"
- );
- JavaScriptUnit compilUnit = (JavaScriptUnit) runConversion(workingCopies[0], true);
- verifyWorkingCopiesComments();
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Verify method javadoc
- ASTNode node = getASTNode(compilUnit, 0, 0);
- assertEquals("Invalid type for node: "+node, ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("Invalid method name", "foo", methodDeclaration.getName().toString());
- JSdoc methodJavadoc = methodDeclaration.getJavadoc();
- assertNotNull("FunctionDeclaration have a javadoc comment", methodJavadoc);
- int javadocStart = methodJavadoc.getStartPosition();
- assertEquals("Method declaration should include javadoc comment", methodDeclaration.getStartPosition(), javadocStart);
- // Verify method first leading and last trailing comment
- int index = compilUnit.firstLeadingCommentIndex(methodDeclaration);
- assertEquals("Invalid first leading comment for "+methodDeclaration, 1, index);
- index = compilUnit.lastTrailingCommentIndex(methodDeclaration);
- assertEquals("Invalid last trailing comment for "+methodDeclaration, 7, index);
- }
- }
- public void testBug113108b() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b113108/Test.js",
- "package javadoc.b113108;\n" +
- "/** C0 */\n" +
- "public class Test {\n" +
- " /** C1 */\n" +
- " // C2\n" +
- " /* C3 */\n" +
- " public void foo() {\n" +
- " // C4\n" +
- " }\n" +
- " /** C5 */\n" +
- " /// C6\n" +
- " /* C7 */\n" +
- "}"
- );
- JavaScriptUnit compilUnit = (JavaScriptUnit) runConversion(workingCopies[0], true);
- verifyWorkingCopiesComments();
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Verify method javadoc
- ASTNode node = getASTNode(compilUnit, 0, 0);
- assertEquals("Invalid type for node: "+node, ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("Invalid method name", "foo", methodDeclaration.getName().toString());
- JSdoc methodJavadoc = methodDeclaration.getJavadoc();
- assertNotNull("FunctionDeclaration have a javadoc comment", methodJavadoc);
- int javadocStart = methodJavadoc.getStartPosition();
- assertEquals("Method declaration should include javadoc comment", methodDeclaration.getStartPosition(), javadocStart);
- // Verify method first leading and last trailing comment
- int index = compilUnit.firstLeadingCommentIndex(methodDeclaration);
- assertEquals("Invalid first leading comment for "+methodDeclaration, 1, index);
- index = compilUnit.lastTrailingCommentIndex(methodDeclaration);
- assertEquals("Invalid last trailing comment for "+methodDeclaration, 7, index);
- }
- }
- public void testBug113108c() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b113108/Test.js",
- "package javadoc.b113108;\n" +
- "/** C0 */\n" +
- "public class Test {\n" +
- " // C1\n" +
- " /* C2 */\n" +
- " /** C3 */\n" +
- " public void foo() {\n" +
- " /** C4 */\n" +
- " }\n" +
- " // C5\n" +
- " /* C6 */\n" +
- " /** C7 */\n" +
- "}"
- );
- JavaScriptUnit compilUnit = (JavaScriptUnit) runConversion(workingCopies[0], true);
- verifyWorkingCopiesComments();
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Verify method javadoc
- ASTNode node = getASTNode(compilUnit, 0, 0);
- assertEquals("Invalid type for node: "+node, ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("Invalid method name", "foo", methodDeclaration.getName().toString());
- JSdoc methodJavadoc = methodDeclaration.getJavadoc();
- assertNotNull("FunctionDeclaration have a javadoc comment", methodJavadoc);
- int javadocStart = methodJavadoc.getStartPosition();
- assertEquals("Method declaration should include javadoc comment", methodDeclaration.getStartPosition(), javadocStart);
- // Verify method first leading and last trailing comment
- int index = compilUnit.firstLeadingCommentIndex(methodDeclaration);
- assertEquals("Invalid first leading comment for "+methodDeclaration, 1, index);
- index = compilUnit.lastTrailingCommentIndex(methodDeclaration);
- assertEquals("Invalid last trailing comment for "+methodDeclaration, 7, index);
- }
- }
-
- /**
- * @bug 125676: [javadoc] @category should not read beyond end of line
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=125676"
- */
- public void testBug125676() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[3];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b125676/A.js",
- "package javadoc.b125676;\n" +
- "public class A {\n" +
- " /**\n" +
- " * @category \n" +
- " * When searching for field matches, it will exclusively find read accesses, as\n" +
- " * opposed to write accesses. Note that some expressions are considered both\n" +
- " * as field read/write accesses: for example, x++; x+= 1;\n" +
- " * \n" +
- " * @since 2.0\n" +
- " */\n" +
- " int READ_ACCESSES = 4;\n" +
- "}\n"
- );
- workingCopies[1] = getWorkingCopy("/Converter15/src/javadoc/b125676/B.js",
- "package javadoc.b125676;\n" +
- "public class B {\n" +
- " /**\n" +
- " * @category test\n" +
- " */\n" +
- " int field1;\n" +
- " /**\n" +
- " * @category test\n" +
- " */\n" +
- " int field2;\n" +
- " /**\n" +
- " * @category test \n" +
- " */\n" +
- " int field3;\n" +
- " /**\n" +
- " * @category test \n" +
- " */\n" +
- " int field4;\n" +
- " /** @category test */\n" +
- " int field5;\n" +
- "\n" +
- "}\n"
- );
- workingCopies[2] = getWorkingCopy("/Converter15/src/javadoc/b125676/C.js",
- "package javadoc.b125676;\n" +
- "public class C { \n" +
- " /**\n" +
- " * @category test mutli ids\n" +
- " */\n" +
- " int field1;\n" +
- " /**\n" +
- " * @category test mutli ids \n" +
- " */\n" +
- " int field2;\n" +
- " /** @category test mutli ids*/\n" +
- " int field3;\n" +
- "}\n"
- );
- verifyWorkingCopiesComments();
- }
-
- /**
- * @bug 125903: [javadoc] Treat whitespace in javadoc tags as invalid tags
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=125903"
- */
- public void testBug125903() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- astLevel = AST.JLS3;
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b125903/Test.js",
- "package javadoc.b125903;\n" +
- "/**\n" +
- " * {@ link java.lang.String}\n" +
- " * @ since 2.1\n" +
- " */\n" +
- "public class Test {\n" +
- "\n" +
- "}\n"
- );
- JavaScriptUnit compilUnit = (JavaScriptUnit) runConversion(workingCopies[0], true);
- verifyWorkingCopiesComments();
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Verify method javadoc
- ASTNode node = getASTNode(compilUnit, 0);
- assertEquals("Invalid type for node: "+node, ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- JSdoc javadoc = typeDeclaration.getJavadoc();
- assertNotNull("TypeDeclaration should have a javadoc comment", javadoc);
- List tags = javadoc.tags();
- TagElement tag = (TagElement) tags.get(0);
- tag = (TagElement) tag.fragments().get(0);
- assertEquals("Tag name should be empty", tag.getTagName(), "@");
- tag = (TagElement) tags.get(1);
- assertEquals("Tag name should be empty", tag.getTagName(), "@");
- }
- }
-
- /**
- * @bug 130752: [comments] first BlockComment parsed as LineComment
- * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=130752"
- */
- public void testBug130752() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b130752/Test.js",
- "/* Ceci n'est pas\n" +
- " * une ligne. */\n" +
- "package javadoc.b130752;\n" +
- "public class Test {\n" +
- "}\n"
- );
- JavaScriptUnit compilUnit = (JavaScriptUnit) runConversion(workingCopies[0], true);
- verifyWorkingCopiesComments();
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Verify comment type
- List unitComments = compilUnit.getCommentList();
- assertEquals("Wrong number of comments", 1, unitComments.size());
- Comment comment = (Comment) unitComments.get(0);
- assertEquals("Comment should be javadoc", comment.getNodeType(), ASTNode.BLOCK_COMMENT);
- }
- }
- public void testBug130752b() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b130752/Test.js",
- "// Line comment\n" +
- "package javadoc.b130752;\n" +
- "public class Test {\n" +
- "}\n"
- );
- JavaScriptUnit compilUnit = (JavaScriptUnit) runConversion(workingCopies[0], true);
- verifyWorkingCopiesComments();
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Verify comment type
- List unitComments = compilUnit.getCommentList();
- assertEquals("Wrong number of comments", 1, unitComments.size());
- Comment comment = (Comment) unitComments.get(0);
- assertEquals("Comment should be javadoc", comment.getNodeType(), ASTNode.LINE_COMMENT);
- }
- }
- public void testBug130752c() throws JavaScriptModelException {
- workingCopies = new IJavaScriptUnit[1];
- workingCopies[0] = getWorkingCopy("/Converter15/src/javadoc/b130752/Test.js",
- "/** Javadoc comment */\n" +
- "package javadoc.b130752;\n" +
- "public class Test {\n" +
- "}\n"
- );
- JavaScriptUnit compilUnit = (JavaScriptUnit) runConversion(workingCopies[0], true);
- verifyWorkingCopiesComments();
- if (docCommentSupport.equals(JavaScriptCore.ENABLED)) {
- // Verify comment type
- List unitComments = compilUnit.getCommentList();
- assertEquals("Wrong number of comments", 1, unitComments.size());
- Comment comment = (Comment) unitComments.get(0);
- assertEquals("Comment should be javadoc", comment.getNodeType(), ASTNode.JSDOC);
- }
- }
-
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterRecoveryTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterRecoveryTest.java
deleted file mode 100644
index 2fbd5ac..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterRecoveryTest.java
+++ /dev/null
@@ -1,923 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.util.List;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.ArrayInitializer;
-import org.eclipse.wst.jsdt.core.dom.Assignment;
-import org.eclipse.wst.jsdt.core.dom.Block;
-import org.eclipse.wst.jsdt.core.dom.EmptyStatement;
-import org.eclipse.wst.jsdt.core.dom.Expression;
-import org.eclipse.wst.jsdt.core.dom.ExpressionStatement;
-import org.eclipse.wst.jsdt.core.dom.ForStatement;
-import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
-import org.eclipse.wst.jsdt.core.dom.ITypeBinding;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.NumberLiteral;
-import org.eclipse.wst.jsdt.core.dom.SimpleName;
-import org.eclipse.wst.jsdt.core.dom.Statement;
-import org.eclipse.wst.jsdt.core.dom.StringLiteral;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement;
-
-public class ASTConverterRecoveryTest extends ConverterTestSetup {
- public ASTConverterRecoveryTest(String name) {
- super(name);
- }
-
- static {
-// TESTS_NAMES = new String[] {"test0003"};
-// TESTS_NUMBERS = new int[] { 624 };
- }
- public static Test suite() {
- return buildModelTestSuite(ASTConverterRecoveryTest.class);
- }
-
- public void setUpSuite() throws Exception {
- super.setUpSuite();
- this.ast = AST.newAST(AST.JLS3);
- }
-
- public void test0001() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " bar(0)\n"+
- " baz(1);\n"+
- " }\n"+
- "}\n");
-
- char[] source = this.workingCopies[0].getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " bar(0);\n" +
- " baz(1);\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 2, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not an expression statement", statement.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) statement;
- checkSourceRange(expressionStatement, "bar(0)", source); //$NON-NLS-1$
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- checkSourceRange(methodInvocation, "bar(0)", source); //$NON-NLS-1$
- List list = methodInvocation.arguments();
- assertTrue("Parameter list is empty", list.size() == 1); //$NON-NLS-1$
- Expression parameter = (Expression) list.get(0);
- assertTrue("Not a number", parameter instanceof NumberLiteral); //$NON-NLS-1$
- ITypeBinding typeBinding = parameter.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(parameter, "0", source); //$NON-NLS-1$
- Statement statement2 = (Statement) statements.get(1);
- assertTrue("Not an expression statement", statement2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement2 = (ExpressionStatement) statement2;
- checkSourceRange(expressionStatement2, "baz(1);", source); //$NON-NLS-1$
- Expression expression2 = expressionStatement2.getExpression();
- assertTrue("Not a method invocation", expression2.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation2 = (FunctionInvocation) expression2;
- checkSourceRange(methodInvocation2, "baz(1)", source); //$NON-NLS-1$
- List list2 = methodInvocation2.arguments();
- assertTrue("Parameter list is empty", list2.size() == 1); //$NON-NLS-1$
- Expression parameter2 = (Expression) list2.get(0);
- assertTrue("Not a number", parameter2 instanceof NumberLiteral); //$NON-NLS-1$
- ITypeBinding typeBinding2 = parameter2.resolveTypeBinding();
- assertNotNull("No binding", typeBinding2); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(parameter2, "1", source); //$NON-NLS-1$
- }
-
- public void test0002() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " baz(0);\n"+
- " bar(1,\n"+
- " }\n"+
- "}\n");
-
- char[] source = this.workingCopies[0].getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " baz(0);\n" +
- " bar(1);\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 2, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not an expression statement", statement.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) statement;
- checkSourceRange(expressionStatement, "baz(0);", source); //$NON-NLS-1$
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- checkSourceRange(methodInvocation, "baz(0)", source); //$NON-NLS-1$
- List list = methodInvocation.arguments();
- assertTrue("Parameter list is empty", list.size() == 1); //$NON-NLS-1$
- Expression parameter = (Expression) list.get(0);
- assertTrue("Not a number", parameter instanceof NumberLiteral); //$NON-NLS-1$
- ITypeBinding typeBinding = parameter.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(parameter, "0", source); //$NON-NLS-1$
- Statement statement2 = (Statement) statements.get(1);
- assertTrue("Not an expression statement", statement2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement2 = (ExpressionStatement) statement2;
- checkSourceRange(expressionStatement2, "bar(1", source); //$NON-NLS-1$
- Expression expression2 = expressionStatement2.getExpression();
- assertTrue("Not a method invocation", expression2.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation2 = (FunctionInvocation) expression2;
- checkSourceRange(methodInvocation2, "bar(1", source); //$NON-NLS-1$
- List list2 = methodInvocation2.arguments();
- assertTrue("Parameter list is empty", list2.size() == 1); //$NON-NLS-1$
- Expression parameter2 = (Expression) list2.get(0);
- assertTrue("Not a number", parameter2 instanceof NumberLiteral); //$NON-NLS-1$
- ITypeBinding typeBinding2 = parameter2.resolveTypeBinding();
- assertNotNull("No binding", typeBinding2); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(parameter2, "1", source); //$NON-NLS-1$
- }
-
- public void test0003() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " baz(0);\n"+
- " bar(1,\n"+
- " foo(3);\n"+
- " }\n"+
- "}\n");
-
- char[] source = this.workingCopies[0].getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " baz(0);\n" +
- " bar(1,foo(3));\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 2, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not an expression statement", statement.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) statement;
- checkSourceRange(expressionStatement, "baz(0);", source); //$NON-NLS-1$
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- checkSourceRange(methodInvocation, "baz(0)", source); //$NON-NLS-1$
- List list = methodInvocation.arguments();
- assertTrue("Parameter list is empty", list.size() == 1); //$NON-NLS-1$
- Expression parameter = (Expression) list.get(0);
- assertTrue("Not a number", parameter instanceof NumberLiteral); //$NON-NLS-1$
- ITypeBinding typeBinding = parameter.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(parameter, "0", source); //$NON-NLS-1$
- Statement statement2 = (Statement) statements.get(1);
- assertTrue("Not an expression statement", statement2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement2 = (ExpressionStatement) statement2;
- checkSourceRange(expressionStatement2, "bar(1,\n\t foo(3);", source); //$NON-NLS-1$
- Expression expression2 = expressionStatement2.getExpression();
- assertTrue("Not a method invocation", expression2.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation2 = (FunctionInvocation) expression2;
- checkSourceRange(methodInvocation2, "bar(1,\n\t foo(3)", source); //$NON-NLS-1$
- List list2 = methodInvocation2.arguments();
- assertTrue("Parameter list is empty", list2.size() == 2); //$NON-NLS-1$
- Expression parameter2 = (Expression) list2.get(0);
- assertTrue("Not a Number", parameter2 instanceof NumberLiteral); //$NON-NLS-1$
- parameter2 = (Expression) list2.get(1);
- assertTrue("Not a method invocation", parameter2 instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation3 = (FunctionInvocation) parameter2;
- checkSourceRange(methodInvocation3, "foo(3)", source); //$NON-NLS-1$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=124296
- public void test0004() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " int var= 123\n"+
- " System.out.println(var);\n"+
- " }\n"+
- "}\n");
-
- char[] source = this.workingCopies[0].getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " int var=123;\n" +
- " System.out.println(var);\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 2, statements.size()); //$NON-NLS-1$
- Statement statement1 = (Statement) statements.get(0);
- assertTrue("Not an expression statement", statement1.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement1;
- checkSourceRange(variableDeclarationStatement, "int var= 123", source); //$NON-NLS-1$
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment)fragments.get(0);
- checkSourceRange(variableDeclarationFragment, "var= 123", source); //$NON-NLS-1$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=126148
- public void test0005() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " String[] s = {\"\",,,};\n"+
- " }\n"+
- "}\n");
-
- char[] source = this.workingCopies[0].getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " String[] s={\"\",$missing$};\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement1 = (Statement) statements.get(0);
- assertTrue("Not an expression variable declaration statement", statement1.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement1;
- checkSourceRange(variableDeclarationStatement, "String[] s = {\"\",,,};", source); //$NON-NLS-1$
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment)fragments.get(0);
- checkSourceRange(variableDeclarationFragment, "s = {\"\",,,}", source); //$NON-NLS-1$
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an array initializer", expression.getNodeType() == ASTNode.ARRAY_INITIALIZER); //$NON-NLS-1$
- ArrayInitializer arrayInitializer = (ArrayInitializer) expression;
- checkSourceRange(arrayInitializer, "{\"\",,,}", source); //$NON-NLS-1$
- List expressions = arrayInitializer.expressions();
- assertEquals("wrong size", 2, expressions.size()); //$NON-NLS-1$
- Expression expression1 = (Expression) expressions.get(0);
- assertTrue("Not a string literal", expression1.getNodeType() == ASTNode.STRING_LITERAL); //$NON-NLS-1$
- StringLiteral stringLiteral = (StringLiteral) expression1;
- checkSourceRange(stringLiteral, "\"\"", source); //$NON-NLS-1$
- Expression expression2 = (Expression) expressions.get(1);
- assertTrue("Not a string literal", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- checkSourceRange(simpleName, ",", source); //$NON-NLS-1$
-
- }
-
- // check RECOVERED flag (insert tokens)
- public void test0006() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " bar()\n"+
- " }\n"+
- "}\n");
-
- char[] source = this.workingCopies[0].getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " bar();\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Flag as RECOVERED", (methodDeclaration.getFlags() & ASTNode.RECOVERED) == 0);
- Block block = methodDeclaration.getBody();
- assertTrue("Flag as RECOVERED", (block.getFlags() & ASTNode.RECOVERED) == 0);
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not an expression statement", statement.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) statement;
- checkSourceRange(expressionStatement, "bar()", source); //$NON-NLS-1$
- assertTrue("Not flag as RECOVERED", (expressionStatement.getFlags() & ASTNode.RECOVERED) != 0);
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation)expression;
- checkSourceRange(methodInvocation, "bar()", source); //$NON-NLS-1$
- assertTrue("Flag as RECOVERED", (methodInvocation.getFlags() & ASTNode.RECOVERED) == 0);
- }
-
- // check RECOVERED flag (insert tokens)
- public void test0007() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " bar(baz()\n"+
- " }\n"+
- "}\n");
-
- char[] source = this.workingCopies[0].getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " bar(baz());\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Flag as RECOVERED", (methodDeclaration.getFlags() & ASTNode.RECOVERED) == 0);
- Block block = methodDeclaration.getBody();
- assertTrue("Flag as RECOVERED", (block.getFlags() & ASTNode.RECOVERED) == 0);
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not an expression statement", statement.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) statement;
- checkSourceRange(expressionStatement, "bar(baz()", source); //$NON-NLS-1$
- assertTrue("Not flag as RECOVERED", (expressionStatement.getFlags() & ASTNode.RECOVERED) != 0);
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation)expression;
- checkSourceRange(methodInvocation, "bar(baz()", source); //$NON-NLS-1$
- assertTrue("Not flag as RECOVERED", (methodInvocation.getFlags() & ASTNode.RECOVERED) != 0);
- List arguments = methodInvocation.arguments();
- assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
- Expression argument = (Expression) arguments.get(0);
- assertTrue("Not a method invocation", argument.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation2 = (FunctionInvocation) argument;
- checkSourceRange(methodInvocation2, "baz()", source); //$NON-NLS-1$
- assertTrue("Flag as RECOVERED", (methodInvocation2.getFlags() & ASTNode.RECOVERED) == 0);
- }
-
- // check RECOVERED flag (insert tokens)
- public void test0008() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " for(int i\n"+
- " }\n"+
- "}\n");
-
- char[] source = this.workingCopies[0].getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " for (int i; ; ) ;\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Flag as RECOVERED", (methodDeclaration.getFlags() & ASTNode.RECOVERED) == 0);
- Block block = methodDeclaration.getBody();
- assertTrue("Not flag as RECOVERED", (block.getFlags() & ASTNode.RECOVERED) != 0);
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not a for statement", statement.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) statement;
- checkSourceRange(forStatement, "for(int i", source); //$NON-NLS-1$
- assertTrue("Not flag as RECOVERED", (forStatement.getFlags() & ASTNode.RECOVERED) != 0);
- List initializers = forStatement.initializers();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Expression expression = (Expression)initializers.get(0);
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.VARIABLE_DECLARATION_EXPRESSION); //$NON-NLS-1$
- VariableDeclarationExpression variableDeclarationExpression = (VariableDeclarationExpression)expression;
- checkSourceRange(variableDeclarationExpression, "int i", source); //$NON-NLS-1$
- assertTrue("Not flag as RECOVERED", (variableDeclarationExpression.getFlags() & ASTNode.RECOVERED) != 0);
- List fragments = variableDeclarationExpression.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment)fragments.get(0);
- checkSourceRange(fragment, "i", source); //$NON-NLS-1$
- assertTrue("Not flag as RECOVERED", (fragment.getFlags() & ASTNode.RECOVERED) != 0);
- SimpleName name = fragment.getName();
- checkSourceRange(name, "i", source); //$NON-NLS-1$
- assertTrue("Flag as RECOVERED", (name.getFlags() & ASTNode.RECOVERED) == 0);
- Statement statement2 = forStatement.getBody();
- assertTrue("Not an empty statement", statement2.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- EmptyStatement emptyStatement = (EmptyStatement)statement2;
- checkSourceRange(emptyStatement, "i", source); //$NON-NLS-1$
- assertTrue("Not flag as RECOVERED", (emptyStatement.getFlags() & ASTNode.RECOVERED) != 0);
- }
-
- // check RECOVERED flag (remove tokens)
- public void test0009() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " bar(baz());#\n"+
- " }\n"+
- "}\n");
-
- char[] source = this.workingCopies[0].getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " bar(baz());\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Flag as RECOVERED", (methodDeclaration.getFlags() & ASTNode.RECOVERED) == 0);
- Block block = methodDeclaration.getBody();
- assertTrue("Not flag as RECOVERED", (block.getFlags() & ASTNode.RECOVERED) != 0);
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not an expression statement", statement.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) statement;
- checkSourceRange(expressionStatement, "bar(baz());", source); //$NON-NLS-1$
- assertTrue("Flag as RECOVERED", (expressionStatement.getFlags() & ASTNode.RECOVERED) == 0);
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation)expression;
- checkSourceRange(methodInvocation, "bar(baz())", source); //$NON-NLS-1$
- assertTrue("Flag as RECOVERED", (methodInvocation.getFlags() & ASTNode.RECOVERED) == 0);
- List arguments = methodInvocation.arguments();
- assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
- Expression argument = (Expression) arguments.get(0);
- assertTrue("Not a method invocation", argument.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation2 = (FunctionInvocation) argument;
- checkSourceRange(methodInvocation2, "baz()", source); //$NON-NLS-1$
- assertTrue("Flag as RECOVERED", (methodInvocation2.getFlags() & ASTNode.RECOVERED) == 0);
- }
-
- // check RECOVERED flag (remove tokens)
- public void test0010() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " bar(baz())#;\n"+
- " }\n"+
- "}\n");
-
- char[] source = this.workingCopies[0].getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " bar(baz());\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Flag as RECOVERED", (methodDeclaration.getFlags() & ASTNode.RECOVERED) == 0);
- Block block = methodDeclaration.getBody();
- assertTrue("Flag as RECOVERED", (block.getFlags() & ASTNode.RECOVERED) == 0);
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not an expression statement", statement.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) statement;
- checkSourceRange(expressionStatement, "bar(baz())#;", source); //$NON-NLS-1$
- assertTrue("Not flag as RECOVERED", (expressionStatement.getFlags() & ASTNode.RECOVERED) != 0);
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation)expression;
- checkSourceRange(methodInvocation, "bar(baz())", source); //$NON-NLS-1$
- assertTrue("Flag as RECOVERED", (methodInvocation.getFlags() & ASTNode.RECOVERED) == 0);
- List arguments = methodInvocation.arguments();
- assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
- Expression argument = (Expression) arguments.get(0);
- assertTrue("Not a method invocation", argument.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation2 = (FunctionInvocation) argument;
- checkSourceRange(methodInvocation2, "baz()", source); //$NON-NLS-1$
- assertTrue("Flag as RECOVERED", (methodInvocation2.getFlags() & ASTNode.RECOVERED) == 0);
- }
-
- // check RECOVERED flag (remove tokens)
- public void test0011() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " bar(baz()#);\n"+
- " }\n"+
- "}\n");
-
- char[] source = this.workingCopies[0].getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " bar(baz());\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Flag as RECOVERED", (methodDeclaration.getFlags() & ASTNode.RECOVERED) == 0);
- Block block = methodDeclaration.getBody();
- assertTrue("Flag as RECOVERED", (block.getFlags() & ASTNode.RECOVERED) == 0);
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not an expression statement", statement.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) statement;
- checkSourceRange(expressionStatement, "bar(baz()#);", source); //$NON-NLS-1$
- assertTrue("Flag as RECOVERED", (expressionStatement.getFlags() & ASTNode.RECOVERED) == 0);
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation)expression;
- checkSourceRange(methodInvocation, "bar(baz()#)", source); //$NON-NLS-1$
- assertTrue("Not flag as RECOVERED", (methodInvocation.getFlags() & ASTNode.RECOVERED) != 0);
- List arguments = methodInvocation.arguments();
- assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
- Expression argument = (Expression) arguments.get(0);
- assertTrue("Not a method invocation", argument.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation2 = (FunctionInvocation) argument;
- checkSourceRange(methodInvocation2, "baz()", source); //$NON-NLS-1$
- assertTrue("Flag as RECOVERED", (methodInvocation2.getFlags() & ASTNode.RECOVERED) == 0);
- }
-
- // check RECOVERED flag (insert tokens)
- public void test0012() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " bar()#\n"+
- " }\n"+
- "}\n");
-
- char[] source = this.workingCopies[0].getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " bar();\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Flag as RECOVERED", (methodDeclaration.getFlags() & ASTNode.RECOVERED) == 0);
- Block block = methodDeclaration.getBody();
- assertTrue("Flag as RECOVERED", (block.getFlags() & ASTNode.RECOVERED) == 0);
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not an expression statement", statement.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) statement;
- checkSourceRange(expressionStatement, "bar()#", source); //$NON-NLS-1$
- assertTrue("Not flag as RECOVERED", (expressionStatement.getFlags() & ASTNode.RECOVERED) != 0);
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation)expression;
- checkSourceRange(methodInvocation, "bar()", source); //$NON-NLS-1$
- assertTrue("Flag as RECOVERED", (methodInvocation.getFlags() & ASTNode.RECOVERED) == 0);
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=129555
- public void test0013() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " a[0]\n"+
- " }\n"+
- "}\n");
-
- char[] source = this.workingCopies[0].getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " a[0]=$missing$;\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Flag as RECOVERED", (methodDeclaration.getFlags() & ASTNode.RECOVERED) == 0);
- Block block = methodDeclaration.getBody();
- assertTrue("Flag as RECOVERED", (block.getFlags() & ASTNode.RECOVERED) != 0);
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not an expression statement", statement.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) statement;
- checkSourceRange(expressionStatement, "a[0]", source); //$NON-NLS-1$
- assertTrue("Not flag as RECOVERED", (expressionStatement.getFlags() & ASTNode.RECOVERED) != 0);
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not an assigment", expression.getNodeType() == ASTNode.ASSIGNMENT); //$NON-NLS-1$
- Assignment assignment = (Assignment)expression;
- checkSourceRange(assignment, "a[0]", source); //$NON-NLS-1$
- assertTrue("Flag as RECOVERED", (assignment.getFlags() & ASTNode.RECOVERED) != 0);
- Expression rhs = assignment.getRightHandSide();
- assertTrue("Not a simple name", rhs.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) rhs;
- assertEquals("Not length isn't correct", 0, simpleName.getLength()); //$NON-NLS-1$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=129909
- public void test0014() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " int[] = a[0];\n"+
- " }\n"+
- "}\n");
-
- char[] source = this.workingCopies[0].getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " int[] $missing$=a[0];\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Flag as RECOVERED", (methodDeclaration.getFlags() & ASTNode.RECOVERED) == 0);
- Block block = methodDeclaration.getBody();
- assertTrue("Flag as RECOVERED", (block.getFlags() & ASTNode.RECOVERED) == 0);
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not a variable declaration statement", statement.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement;
- checkSourceRange(variableDeclarationStatement, "int[] = a[0];", source); //$NON-NLS-1$
- assertTrue("Not flag as RECOVERED", (variableDeclarationStatement.getFlags() & ASTNode.RECOVERED) != 0);
- List fragments = variableDeclarationStatement.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- SimpleName simpleName = fragment.getName();
- assertEquals("Not length isn't correct", 0, simpleName.getLength()); //$NON-NLS-1$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=143212
- public void test0015() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " assert 0 == 0 : a[0;\n"+
- " }\n"+
- "}\n");
-
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " assert 0 == 0 : a[0];\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Flag as RECOVERED", (methodDeclaration.getFlags() & ASTNode.RECOVERED) == 0);
- Block block = methodDeclaration.getBody();
- assertTrue("Flag as RECOVERED", (block.getFlags() & ASTNode.RECOVERED) == 0);
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=143212
- public void test0016() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " assert 0 == 0 : foo(;\n"+
- " }\n"+
- "}\n");
-
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " assert 0 == 0 : foo();\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Flag as RECOVERED", (methodDeclaration.getFlags() & ASTNode.RECOVERED) == 0);
- Block block = methodDeclaration.getBody();
- assertTrue("Flag as RECOVERED", (block.getFlags() & ASTNode.RECOVERED) == 0);
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- }
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=143212
- public void test0017() throws JavaScriptModelException {
- this.workingCopies = new IJavaScriptUnit[1];
- this.workingCopies[0] = getWorkingCopy(
- "/Converter/src/test/X.js",
- "package test;\n"+
- "\n"+
- "public class X {\n"+
- " void foo() {\n"+
- " assert 0 == 0 : (\"aa\";\n"+
- " }\n"+
- "}\n");
-
- ASTNode result = runConversion(AST.JLS3, this.workingCopies[0], true, true);
-
- assertASTNodeEquals(
- "package test;\n" +
- "public class X {\n" +
- " void foo(){\n" +
- " assert 0 == 0 : (\"aa\");\n" +
- " }\n" +
- "}\n",
- result);
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Flag as RECOVERED", (methodDeclaration.getFlags() & ASTNode.RECOVERED) == 0);
- Block block = methodDeclaration.getBody();
- assertTrue("Flag as RECOVERED", (block.getFlags() & ASTNode.RECOVERED) == 0);
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTest.java
deleted file mode 100644
index 9b97b0b..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTest.java
+++ /dev/null
@@ -1,8795 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.util.List;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.IField;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTMatcher;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.ArrayAccess;
-import org.eclipse.wst.jsdt.core.dom.ArrayCreation;
-import org.eclipse.wst.jsdt.core.dom.ArrayInitializer;
-import org.eclipse.wst.jsdt.core.dom.ArrayType;
-import org.eclipse.wst.jsdt.core.dom.Assignment;
-import org.eclipse.wst.jsdt.core.dom.Block;
-import org.eclipse.wst.jsdt.core.dom.BooleanLiteral;
-import org.eclipse.wst.jsdt.core.dom.BreakStatement;
-import org.eclipse.wst.jsdt.core.dom.CatchClause;
-import org.eclipse.wst.jsdt.core.dom.CharacterLiteral;
-import org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation;
-import org.eclipse.wst.jsdt.core.dom.ConditionalExpression;
-import org.eclipse.wst.jsdt.core.dom.ContinueStatement;
-import org.eclipse.wst.jsdt.core.dom.DoStatement;
-import org.eclipse.wst.jsdt.core.dom.EmptyStatement;
-import org.eclipse.wst.jsdt.core.dom.Expression;
-import org.eclipse.wst.jsdt.core.dom.ExpressionStatement;
-import org.eclipse.wst.jsdt.core.dom.FieldAccess;
-import org.eclipse.wst.jsdt.core.dom.ForStatement;
-import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
-import org.eclipse.wst.jsdt.core.dom.IBinding;
-import org.eclipse.wst.jsdt.core.dom.IFunctionBinding;
-import org.eclipse.wst.jsdt.core.dom.ITypeBinding;
-import org.eclipse.wst.jsdt.core.dom.IVariableBinding;
-import org.eclipse.wst.jsdt.core.dom.IfStatement;
-import org.eclipse.wst.jsdt.core.dom.InfixExpression;
-import org.eclipse.wst.jsdt.core.dom.JSdoc;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.LabeledStatement;
-import org.eclipse.wst.jsdt.core.dom.Modifier;
-import org.eclipse.wst.jsdt.core.dom.Name;
-import org.eclipse.wst.jsdt.core.dom.NullLiteral;
-import org.eclipse.wst.jsdt.core.dom.NumberLiteral;
-import org.eclipse.wst.jsdt.core.dom.ParenthesizedExpression;
-import org.eclipse.wst.jsdt.core.dom.PostfixExpression;
-import org.eclipse.wst.jsdt.core.dom.PrefixExpression;
-import org.eclipse.wst.jsdt.core.dom.QualifiedName;
-import org.eclipse.wst.jsdt.core.dom.ReturnStatement;
-import org.eclipse.wst.jsdt.core.dom.SimpleName;
-import org.eclipse.wst.jsdt.core.dom.SimpleType;
-import org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.wst.jsdt.core.dom.Statement;
-import org.eclipse.wst.jsdt.core.dom.StringLiteral;
-import org.eclipse.wst.jsdt.core.dom.SwitchCase;
-import org.eclipse.wst.jsdt.core.dom.SwitchStatement;
-import org.eclipse.wst.jsdt.core.dom.ThrowStatement;
-import org.eclipse.wst.jsdt.core.dom.TryStatement;
-import org.eclipse.wst.jsdt.core.dom.Type;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.WhileStatement;
-
-public class ASTConverterTest extends ConverterTestSetup {
-
- /** @deprecated using deprecated code */
- public void setUpSuite() throws Exception {
- super.setUpSuite();
- this.ast = AST.newAST(AST.JLS2);
- }
-
- public ASTConverterTest(String name) {
- super(name);
- }
-
- static {
-// TESTS_NUMBERS = new int[] { 305 };
- }
- public static Test suite() {
- return buildModelTestSuite(ASTConverterTest.class);
- }
-
- public void test00() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0005", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ExpressionStatement statement = (ExpressionStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0);
- ASTNode expression=statement.getExpression();
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
-
- FunctionInvocation methodInvocation = this.ast.newFunctionInvocation();
- ArrayAccess arrayAccess = this.ast.newArrayAccess();
- arrayAccess.setArray(this.ast.newSimpleName("args"));
- arrayAccess.setIndex(this.ast.newNumberLiteral("5"));
- methodInvocation.setExpression(arrayAccess);
-
- NumberLiteral literal = this.ast.newNumberLiteral("1");
- methodInvocation.arguments().add(literal);
-
-
- assertTrue("Both AST trees should be identical", methodInvocation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "args[5](1)", source); //$NON-NLS-1$
- }
-
- /** @deprecated using deprecated code */
- public void test0001() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0001", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
-
- // check that we have the right tree
- JavaScriptUnit unit = this.ast.newJavaScriptUnit();
-// PackageDeclaration packageDeclaration = this.ast.newPackageDeclaration();
-// packageDeclaration.setName(this.ast.newSimpleName("test0001"));//$NON-NLS-1$
-// unit.setPackage(packageDeclaration);
-// ImportDeclaration importDeclaration = this.ast.newImportDeclaration();
-// QualifiedName name =
-// this.ast.newQualifiedName(
-// this.ast.newSimpleName("java"),//$NON-NLS-1$
-// this.ast.newSimpleName("util"));//$NON-NLS-1$
-// importDeclaration.setName(name);
-// importDeclaration.setOnDemand(true);
-// unit.imports().add(importDeclaration);
-// TypeDeclaration type = this.ast.newTypeDeclaration();
-// type.setInterface(false);
-// type.setModifiers(Modifier.PUBLIC);
-// type.setName(this.ast.newSimpleName("Test"));//$NON-NLS-1$
- FunctionDeclaration methodDeclaration = this.ast.newFunctionDeclaration();
- methodDeclaration.setConstructor(false);
-// methodDeclaration.setModifiers(Modifier.PUBLIC | Modifier.STATIC);
- methodDeclaration.setName(this.ast.newSimpleName("main"));//$NON-NLS-1$
-// methodDeclaration.setReturnType(this.ast.newPrimitiveType(PrimitiveType.VOID));
- SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration();
-// variableDeclaration.setModifiers(Modifier.NONE);
-// variableDeclaration.setType(this.ast.newArrayType(this.ast.newSimpleType(this.ast.newSimpleName("String"))));//$NON-NLS-1$
- variableDeclaration.setName(this.ast.newSimpleName("args"));//$NON-NLS-1$
- methodDeclaration.parameters().add(variableDeclaration);
- org.eclipse.wst.jsdt.core.dom.Block block = this.ast.newBlock();
- FunctionInvocation methodInvocation = this.ast.newFunctionInvocation();
- QualifiedName name =
- this.ast.newQualifiedName(
- this.ast.newSimpleName("System"),//$NON-NLS-1$
- this.ast.newSimpleName("out"));//$NON-NLS-1$
- methodInvocation.setExpression(name);
- methodInvocation.setName(this.ast.newSimpleName("println")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();
- literal.setLiteralValue("Hello");//$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();
- literal.setLiteralValue(" world");//$NON-NLS-1$
- infixExpression.setRightOperand(literal);//$NON-NLS-1$
- methodInvocation.arguments().add(infixExpression);
- ExpressionStatement expressionStatement = this.ast.newExpressionStatement(methodInvocation);
- block.statements().add(expressionStatement);
- methodDeclaration.setBody(block);
- unit.statements().add(methodDeclaration);
- assertTrue("Both AST trees should be identical", result.subtreeMatch(new ASTMatcher(), unit));//$NON-NLS-1$
- String expected =
- "function main(args) {\n" +
- " print(\"Hello\" + \" world\");\n" +
- "}" +
- "";
- checkSourceRange(result, expected, source);
- }
-
- /**
- * Test allocation expression: new Object() ==> ClassInstanceCreation
- * @deprecated using deprecated code
- */
- public void test0002() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0002", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
- classInstanceCreation.setMember(this.ast.newSimpleName("Object")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new Object()", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new java.lang.Object() ==> ClassInstanceCreation
- * @deprecated using deprecated code
- */
- public void test0003() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0003", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
-
- FieldAccess expr = this.ast.newFieldAccess();
- expr.setName(this.ast.newSimpleName("Object"));
-
- FieldAccess expr2 = this.ast.newFieldAccess();
- expr2.setName(this.ast.newSimpleName("lang"));
- expr2.setExpression(this.ast.newSimpleName("java"));
-
- expr.setExpression(expr2);
-
- classInstanceCreation.setMember(expr);
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new java.lang.Object()", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new java.lang.Exception("ERROR") ==> ClassInstanceCreation
- * @deprecated using deprecated code
- */
- public void test0004() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0004", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
-
- FieldAccess expr = this.ast.newFieldAccess();
- expr.setName(this.ast.newSimpleName("Exception"));
-
- FieldAccess expr2 = this.ast.newFieldAccess();
- expr2.setName(this.ast.newSimpleName("lang"));
- expr2.setExpression(this.ast.newSimpleName("java"));
-
- expr.setExpression(expr2);
-
- classInstanceCreation.setMember(expr);
- StringLiteral literal = this.ast.newStringLiteral();
- literal.setLiteralValue("ERROR"); //$NON-NLS-1$
- classInstanceCreation.arguments().add(literal);
- assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "new java.lang.Exception(\"ERROR\")", source); //$NON-NLS-1$
- }
-
- public void test0005() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0005", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ExpressionStatement statement = (ExpressionStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0);
- ASTNode expression=statement.getExpression();
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
-
- FunctionInvocation methodInvocation = this.ast.newFunctionInvocation();
- ArrayAccess arrayAccess = this.ast.newArrayAccess();
- arrayAccess.setArray(this.ast.newSimpleName("args"));
- arrayAccess.setIndex(this.ast.newNumberLiteral("5"));
- methodInvocation.setExpression(arrayAccess);
-
- NumberLiteral literal = this.ast.newNumberLiteral("1");
- methodInvocation.arguments().add(literal);
-
-
- assertTrue("Both AST trees should be identical", methodInvocation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "args[5](1)", source); //$NON-NLS-1$
- }
-
-
-// /**
-// * Test allocation expression: new java.lang.Runnable() { public void run() {}} ==> ClassInstanceCreation
-// * @deprecated using deprecated code
-// */
-// public void test0006() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0006", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
-// assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
-// ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
-// QualifiedName name =
-// this.ast.newQualifiedName(
-// this.ast.newQualifiedName(
-// this.ast.newSimpleName("java"), //$NON-NLS-1$
-// this.ast.newSimpleName("lang")), //$NON-NLS-1$
-// this.ast.newSimpleName("Runnable"));//$NON-NLS-1$
-// classInstanceCreation.setName(name);
-// FunctionDeclaration methodDeclaration = this.ast.newMethodDeclaration();
-// methodDeclaration.setBody(this.ast.newBlock());
-// methodDeclaration.setConstructor(false);
-// methodDeclaration.setModifiers(Modifier.PUBLIC);
-// methodDeclaration.setName(this.ast.newSimpleName("run"));//$NON-NLS-1$
-// methodDeclaration.setReturnType(this.ast.newPrimitiveType(PrimitiveType.VOID));
-// AnonymousClassDeclaration anonymousClassDeclaration = this.ast.newAnonymousClassDeclaration();
-// anonymousClassDeclaration.bodyDeclarations().add(methodDeclaration);
-// classInstanceCreation.setAnonymousClassDeclaration(anonymousClassDeclaration);
-// assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
-// checkSourceRange(expression, "new java.lang.Runnable() { public void run() {}}", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Test allocation expression: new Test().new D() ==> ClassInstanceCreation
-// * @deprecated using deprecated code
-// */
-// public void test0007() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0007", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
-// ExpressionStatement expressionStatement = (ExpressionStatement) node;
-// ASTNode expression = (ASTNode) ((FunctionInvocation) expressionStatement.getExpression()).arguments().get(0);
-// assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
-// ClassInstanceCreation classInstanceCreation = this.ast.newClassInstanceCreation();
-// classInstanceCreation.setName(this.ast.newSimpleName("D")); //$NON-NLS-1$
-// ClassInstanceCreation classInstanceCreationExpression = this.ast.newClassInstanceCreation();
-// classInstanceCreationExpression.setName(this.ast.newSimpleName("Test")); //$NON-NLS-1$
-// classInstanceCreation.setExpression(classInstanceCreationExpression);
-// assertTrue("Both AST trees should be identical", classInstanceCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
-// checkSourceRange(expression, "new Test().new D()", source); //$NON-NLS-1$
-// }
-
- /**
- * Test allocation expression: new int[] {1, 2, 3, 4} ==> ArrayCreation
- */
- public void test0008() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0008", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ArrayInitializer arrayInitializer = this.ast.newArrayInitializer();
- arrayInitializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$
- arrayInitializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- arrayInitializer.expressions().add(this.ast.newNumberLiteral("3"));//$NON-NLS-1$
- arrayInitializer.expressions().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", arrayInitializer.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "[1, 2, 3, 4]", source); //$NON-NLS-1$
- }
-
- /**
- * Test allocation expression: new int[][] {{1}, {2}} ==> ArrayCreation
- */
- public void test0009() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0009", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- ArrayInitializer arrayInitializer = this.ast.newArrayInitializer();
- ArrayInitializer innerArrayInitializer = this.ast.newArrayInitializer();
- innerArrayInitializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$
- arrayInitializer.expressions().add(innerArrayInitializer);
- innerArrayInitializer = this.ast.newArrayInitializer();
- innerArrayInitializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- arrayInitializer.expressions().add(innerArrayInitializer);
- assertTrue("Both AST trees should be identical", arrayInitializer.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "[[1], [2]]", source); //$NON-NLS-1$
- }
-
-// /**
-// * Test allocation expression: new int[3] ==> ArrayCreation
-// */
-// public void test0010() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0010", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
-// assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
-// ArrayCreation arrayCreation = this.ast.newArrayCreation();
-// arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1));
-// arrayCreation.dimensions().add(this.ast.newNumberLiteral("3")); //$NON-NLS-1$
-// assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
-// checkSourceRange(expression, "new int[3]", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Test allocation expression: new int[3][] ==> ArrayCreation
-// */
-// public void test0011() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0011", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
-// assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
-// ArrayCreation arrayCreation = this.ast.newArrayCreation();
-// arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 2));
-// arrayCreation.dimensions().add(this.ast.newNumberLiteral("3")); //$NON-NLS-1$
-// assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
-// checkSourceRange(expression, "new int[3][]", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Test allocation expression: new int[][] {{},{}} ==> ArrayCreation
-// */
-// public void test0012() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0012", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
-// assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
-// ArrayCreation arrayCreation = this.ast.newArrayCreation();
-// arrayCreation.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 2));
-// ArrayInitializer arrayInitializer = this.ast.newArrayInitializer();
-// ArrayInitializer innerArrayInitializer = this.ast.newArrayInitializer();
-// arrayInitializer.expressions().add(innerArrayInitializer);
-// innerArrayInitializer = this.ast.newArrayInitializer();
-// arrayInitializer.expressions().add(innerArrayInitializer);
-// arrayCreation.setInitializer(arrayInitializer);
-// assertTrue("Both AST trees should be identical", arrayCreation.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
-// checkSourceRange(expression, "new int[][] {{}, {}}", source); //$NON-NLS-1$
-// }
-
- /**
- * int i; ==> VariableDeclarationFragment
- * @deprecated using deprecated code
- */
- public void test0013() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0013", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var i;", source); //$NON-NLS-1$
- }
-
- /**
- * int i = 0; ==> VariableDeclarationFragment
- * @deprecated using deprecated code
- */
- public void test0014() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0014", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var i = 0;", source); //$NON-NLS-1$
- }
-
- /**
- * i = 1; ==> ExpressionStatement(Assignment)
- */
- public void test0015() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0015", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("1")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i = 1;", source); //$NON-NLS-1$
- }
-
- /**
- * i += 2; ==> ExpressionStatement(Assignment)
- */
- public void test0016() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0016", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.PLUS_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i += 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i -= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0017() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0017", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.MINUS_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i -= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i *= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0018() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0018", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.TIMES_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i *= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i /= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0019() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0019", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.DIVIDE_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i /= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i &= 2 ==> ExpressionStatement(Assignment)
- */
- public void test0020() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0020", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.BIT_AND_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i &= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i |= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0021() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0021", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.BIT_OR_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i |= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i ^= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0022() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0022", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.BIT_XOR_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i ^= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i %= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0023() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0023", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.REMAINDER_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i %= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i <<= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0024() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0024", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.LEFT_SHIFT_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i <<= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i >>= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0025() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0025", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_SIGNED_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i >>= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * i >>>= 2; ==> ExpressionStatement(Assignment)
- */
- public void test0026() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0026", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- Assignment assignment = this.ast.newAssignment();
- assignment.setLeftHandSide(this.ast.newSimpleName("i")); //$NON-NLS-1$
- assignment.setRightHandSide(this.ast.newNumberLiteral("2")); //$NON-NLS-1$
- assignment.setOperator(Assignment.Operator.RIGHT_SHIFT_UNSIGNED_ASSIGN);
- ExpressionStatement statement = this.ast.newExpressionStatement(assignment);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i >>>= 2;", source); //$NON-NLS-1$
- }
-
- /**
- * --i; ==> ExpressionStatement(PrefixExpression)
- */
- public void test0027() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0027", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- prefixExpression.setOperator(PrefixExpression.Operator.DECREMENT);//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(prefixExpression);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "--i;", source); //$NON-NLS-1$
- }
-
- /**
- * --i; ==> ExpressionStatement(PrefixExpression)
- */
- public void test0028() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0028", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT);//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(prefixExpression);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "++i;", source); //$NON-NLS-1$
- }
-
- /**
- * i--; ==> ExpressionStatement(PostfixExpression)
- */
- public void test0029() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0029", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.DECREMENT);//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(postfixExpression);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i--;", source); //$NON-NLS-1$
- }
-
- /**
- * i++; ==> ExpressionStatement(PostfixExpression)
- */
- public void test0030() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0030", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(postfixExpression);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "i++;", source); //$NON-NLS-1$
- }
-
-// /**
-// * (String) o; ==> ExpressionStatement(CastExpression)
-// * @deprecated using deprecated code
-// */
-// public void test0031() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0031", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$
-// CastExpression castExpression = this.ast.newCastExpression();
-// castExpression.setExpression(this.ast.newSimpleName("o"));//$NON-NLS-1$
-// castExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
-// variableDeclarationFragment.setInitializer(castExpression);
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "String s = (String) o;", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * (int) d; ==> ExpressionStatement(CastExpression)
-// * @deprecated using deprecated code
-// */
-// public void test0032() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0032", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
-// CastExpression castExpression = this.ast.newCastExpression();
-// castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$
-// castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));//$NON-NLS-1$
-// variableDeclarationFragment.setInitializer(castExpression);
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));//$NON-NLS-1$
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "int i = (int) d;", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * (float) d; ==> ExpressionStatement(CastExpression)
-// * @deprecated using deprecated code
-// */
-// public void test0033() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0033", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-//
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("f")); //$NON-NLS-1$
-// CastExpression castExpression = this.ast.newCastExpression();
-// castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$
-// castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.FLOAT));//$NON-NLS-1$
-// variableDeclarationFragment.setInitializer(castExpression);
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.FLOAT));//$NON-NLS-1$
-//
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "float f = (float) d;", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * (byte) d; ==> ExpressionStatement(CastExpression)
-// * @deprecated using deprecated code
-// */
-// public void test0034() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0034", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-//
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$
-// CastExpression castExpression = this.ast.newCastExpression();
-// castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$
-// castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.BYTE));//$NON-NLS-1$
-// variableDeclarationFragment.setInitializer(castExpression);
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BYTE));//$NON-NLS-1$
-//
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "byte b = (byte) d;", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * (short) d; ==> ExpressionStatement(CastExpression)
-// * @deprecated using deprecated code
-// */
-// public void test0035() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0035", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-//
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$
-// CastExpression castExpression = this.ast.newCastExpression();
-// castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$
-// castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.SHORT));//$NON-NLS-1$
-// variableDeclarationFragment.setInitializer(castExpression);
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.SHORT));//$NON-NLS-1$
-//
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "short s = (short) d;", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * (long) d; ==> ExpressionStatement(CastExpression)
-// * @deprecated using deprecated code
-// */
-// public void test0036() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0036", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-//
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("l")); //$NON-NLS-1$
-// CastExpression castExpression = this.ast.newCastExpression();
-// castExpression.setExpression(this.ast.newSimpleName("d"));//$NON-NLS-1$
-// castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.LONG));//$NON-NLS-1$
-// variableDeclarationFragment.setInitializer(castExpression);
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.LONG));//$NON-NLS-1$
-//
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "long l = (long) d;", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * (char) i; ==> ExpressionStatement(CastExpression)
-// * @deprecated using deprecated code
-// */
-// public void test0037() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0037", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-//
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$
-// CastExpression castExpression = this.ast.newCastExpression();
-// castExpression.setExpression(this.ast.newSimpleName("i"));//$NON-NLS-1$
-// castExpression.setType(this.ast.newPrimitiveType(PrimitiveType.CHAR));//$NON-NLS-1$
-// variableDeclarationFragment.setInitializer(castExpression);
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.CHAR));//$NON-NLS-1$
-//
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "char c = (char) i;", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * int.class; ==> ExpressionStatement(TypeLiteral)
-// * @deprecated using deprecated code
-// */
-// public void test0038() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0038", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-//
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$
-// TypeLiteral typeLiteral = this.ast.newTypeLiteral();
-// typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-// variableDeclarationFragment.setInitializer(typeLiteral);
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$
-//
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "int.class", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * void.class; ==> ExpressionStatement(TypeLiteral)
-// * @deprecated using deprecated code
-// */
-// public void test0039() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0039", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-//
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$
-// TypeLiteral typeLiteral = this.ast.newTypeLiteral();
-// typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.VOID));
-// variableDeclarationFragment.setInitializer(typeLiteral);
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$
-//
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "void.class", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * double.class; ==> ExpressionStatement(TypeLiteral)
-// * @deprecated using deprecated code
-// */
-// public void test0040() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0040", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-//
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$
-// TypeLiteral typeLiteral = this.ast.newTypeLiteral();
-// typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.DOUBLE));
-// variableDeclarationFragment.setInitializer(typeLiteral);
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$
-//
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "double.class", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * long.class; ==> ExpressionStatement(TypeLiteral)
-// * @deprecated using deprecated code
-// */
-// public void test0041() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0041", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-//
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("c")); //$NON-NLS-1$
-// TypeLiteral typeLiteral = this.ast.newTypeLiteral();
-// typeLiteral.setType(this.ast.newPrimitiveType(PrimitiveType.LONG));
-// variableDeclarationFragment.setInitializer(typeLiteral);
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newSimpleType(this.ast.newSimpleName("Class")));//$NON-NLS-1$
-//
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(((VariableDeclarationFragment)((VariableDeclarationStatement)node).fragments().get(0)).getInitializer(), "long.class", source); //$NON-NLS-1$
-// }
-
- /**
- * false ==> BooleanLiteral
- */
- public void test0042() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0042", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- BooleanLiteral literal = this.ast.newBooleanLiteral(false);
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "false", source); //$NON-NLS-1$
- }
-
- /**
- * true ==> BooleanLiteral
- */
- public void test0043() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0043", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- BooleanLiteral literal = this.ast.newBooleanLiteral(true);
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "true", source); //$NON-NLS-1$
- }
-
- /**
- * null ==> NullLiteral
- */
- public void test0044() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0044", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NullLiteral literal = this.ast.newNullLiteral();
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "null", source); //$NON-NLS-1$
- }
-
- /**
- * CharLiteral ==> CharacterLiteral
- */
- public void test0045() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0045", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- CharacterLiteral literal = this.ast.newCharacterLiteral();
- literal.setEscapedValue("'c'"); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "'c'", source); //$NON-NLS-1$
- }
-
- /**
- * DoubleLiteral ==> NumberLiteral
- */
- public void test0046() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0046", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("1.00001");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "1.00001", source); //$NON-NLS-1$
- }
-
- /**
- * FloatLiteral ==> NumberLiteral
- */
- public void test0047() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0047", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("1.00001f");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "1.00001f", source); //$NON-NLS-1$
- }
-
- /**
- * IntLiteral ==> NumberLiteral
- */
- public void test0048() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0048", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("30000");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "30000", source); //$NON-NLS-1$
- }
-
- /**
- * IntLiteralMinValue ==> NumberLiteral
- */
- public void test0049() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0049", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("-2147483648");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "-2147483648", source); //$NON-NLS-1$
- }
-
- /**
- * LongLiteral ==> NumberLiteral
- */
- public void test0050() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0050", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("2147483648L");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "2147483648L", source); //$NON-NLS-1$
- }
-
- /**
- * LongLiteral ==> NumberLiteral (negative value)
- */
- public void test0051() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0051", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("2147483648L");//$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperand(literal);
- prefixExpression.setOperator(PrefixExpression.Operator.MINUS);
- assertTrue("Both AST trees should be identical", prefixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "-2147483648L", source); //$NON-NLS-1$
- }
-
- /**
- * LongLiteralMinValue ==> NumberLiteral
- */
- public void test0052() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0052", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral("-9223372036854775808L");//$NON-NLS-1$
- assertTrue("Both AST trees should be identical", literal.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "-9223372036854775808L", source); //$NON-NLS-1$
- }
-
- /**
- * ExtendedStringLiteral ==> StringLiteral
- */
- public void test0053() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0053", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- /*
- StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("Hello World");*/
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();
- literal.setLiteralValue("Hello");//$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();
- literal.setLiteralValue(" World");//$NON-NLS-1$
- infixExpression.setRightOperand(literal);//$NON-NLS-1$
-
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"Hello\" + \" World\"", source); //$NON-NLS-1$
- }
-
- /**
- * AND_AND_Expression ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0054() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0054", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.CONDITIONAL_AND);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var b3 = b && b2;", source); //$NON-NLS-1$
- }
-
- /**
- * OR_OR_Expression ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0055() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0055", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.CONDITIONAL_OR);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var b3 = b || b2;", source); //$NON-NLS-1$
- }
-
- /**
- * EqualExpression ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0056() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0056", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b3")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.EQUALS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var b3 = b == b2;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (+) ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0057() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0057", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var n = i + j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (-) ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0058() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0058", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.MINUS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var n = i - j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (*) ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0059() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0059", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.TIMES);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var n = i * j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (/) ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0060() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0060", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.DIVIDE);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var n = i / j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (%) ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0061() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0061", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.REMAINDER);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var n = i % j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (^) ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0062() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0062", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.XOR);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var n = i ^ j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (&) ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0063() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0063", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.AND);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var n = i & j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (|) ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0064() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0064", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("j")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.OR);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var n = i | j;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (<) ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0065() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0065", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var b2 = b < b1;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (<=) ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0066() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0066", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS_EQUALS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var b2 = b <= b1;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (>) ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0067() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0067", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.GREATER);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var b2 = b > b1;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (>=) ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0068() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0068", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.GREATER_EQUALS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var b2 = b >= b1;", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression (!=) ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0069() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0069", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b2")); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("b")); //$NON-NLS-1$
- infixExpression.setRightOperand(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.NOT_EQUALS);
- variableDeclarationFragment.setInitializer(infixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var b2 = b != b1;", source); //$NON-NLS-1$
- }
-
- /**
- * InstanceofExpression ==> InfixExpression
- * @deprecated using deprecated code
- */
- public void test0070() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0070", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$
- InfixExpression instanceOfExpression = this.ast.newInfixExpression();
- instanceOfExpression.setLeftOperand(this.ast.newSimpleName("o"));//$NON-NLS-1$
- instanceOfExpression.setOperator(InfixExpression.Operator.INSTANCEOF);
-// SimpleType simpleType = this.ast.newSimpleType(this.ast.newSimpleName("Integer"));//$NON-NLS-1$
- instanceOfExpression.setRightOperand(this.ast.newSimpleName("Number"));
- variableDeclarationFragment.setInitializer(instanceOfExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var b = o instanceof Number;", source); //$NON-NLS-1$
- }
-
-// /**
-// * InstanceofExpression ==> InfixExpression
-// * @deprecated using deprecated code
-// */
-// public void test0071() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0071", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-//
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$
-// InstanceofExpression instanceOfExpression = this.ast.newInstanceofExpression();
-// instanceOfExpression.setLeftOperand(this.ast.newSimpleName("o")); //$NON-NLS-1$
-// QualifiedName name =
-// this.ast.newQualifiedName(
-// this.ast.newQualifiedName(
-// this.ast.newSimpleName("java"), //$NON-NLS-1$
-// this.ast.newSimpleName("lang")), //$NON-NLS-1$
-// this.ast.newSimpleName("Integer")); //$NON-NLS-1$
-// Type type = ast.newSimpleType(name);
-// instanceOfExpression.setRightOperand(type);
-// variableDeclarationFragment.setInitializer(instanceOfExpression);
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// statement.setModifiers(Modifier.NONE);
-//// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-//
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "var b = o instanceof java.lang.Integer;", source); //$NON-NLS-1$
-// }
-
- /**
- * UnaryExpression (!) ==> PrefixExpression
- * @deprecated using deprecated code
- */
- public void test0072() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0072", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b1")); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperator(PrefixExpression.Operator.NOT);
- prefixExpression.setOperand(this.ast.newSimpleName("b"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(prefixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var b1 = !b;", source); //$NON-NLS-1$
- }
-
- /**
- * UnaryExpression (~) ==> PrefixExpression
- * @deprecated using deprecated code
- */
- public void test0073() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0073", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("n")); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperator(PrefixExpression.Operator.COMPLEMENT);
- prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(prefixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var n = ~i;", source); //$NON-NLS-1$
- }
-
- /**
- * UnaryExpression (+) ==> PrefixExpression
- * @deprecated using deprecated code
- */
- public void test0074() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0074", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperator(PrefixExpression.Operator.PLUS);
- prefixExpression.setOperand(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(prefixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var i = +2;", source); //$NON-NLS-1$
- }
-
- /**
- * UnaryExpression (-) ==> PrefixExpression
- * @deprecated using deprecated code
- */
- public void test0075() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0075", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- PrefixExpression prefixExpression = this.ast.newPrefixExpression();
- prefixExpression.setOperator(PrefixExpression.Operator.MINUS);
- prefixExpression.setOperand(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(prefixExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var i = -2;", source); //$NON-NLS-1$
- }
-
- /**
- * ConditionalExpression ==> ConditionalExpression
- * @deprecated using deprecated code
- */
- public void test0076() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0076", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("b")); //$NON-NLS-1$
- ConditionalExpression conditionalExpression = this.ast.newConditionalExpression();
- InfixExpression condition = this.ast.newInfixExpression();
- condition.setLeftOperand(this.ast.newSimpleName("args")); //$NON-NLS-1$
- condition.setRightOperand(this.ast.newNullLiteral()); //$NON-NLS-1$
- condition.setOperator(InfixExpression.Operator.NOT_EQUALS);
- conditionalExpression.setExpression(condition);
- conditionalExpression.setThenExpression(this.ast.newBooleanLiteral(true));
- conditionalExpression.setElseExpression(this.ast.newBooleanLiteral(false));
- variableDeclarationFragment.setInitializer(conditionalExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.BOOLEAN));
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var b = args != null ? true : false;", source); //$NON-NLS-1$
- }
-
- /**
- * ConditionalExpression ==> ConditionalExpression
- * @deprecated using deprecated code
- */
- public void test0077() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0077", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- ConditionalExpression conditionalExpression = this.ast.newConditionalExpression();
- conditionalExpression.setExpression(this.ast.newBooleanLiteral(true));
-// QualifiedName name =
-// this.ast.newQualifiedName(
-// this.ast.newSimpleName("args"), //$NON-NLS-1$
-// this.ast.newSimpleName("length")); //$NON-NLS-1$
-// conditionalExpression.setThenExpression(name);
- FieldAccess fieldAccess=this.ast.newFieldAccess();
- fieldAccess.setExpression(this.ast.newSimpleName("args"));
- fieldAccess.setName(this.ast.newSimpleName("length"));
- conditionalExpression.setThenExpression(fieldAccess);
- conditionalExpression.setElseExpression(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(conditionalExpression);
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
- statement.setModifiers(Modifier.NONE);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var i = true ? args.length: 0;", source); //$NON-NLS-1$
- }
-//
-// /**
-// * MessageSend ==> SuperMethodInvocation
-// */
-// public void test0078() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0078", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// SuperMethodInvocation superMethodInvocation = this.ast.newSuperMethodInvocation();
-// superMethodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$
-// ExpressionStatement statement = this.ast.newExpressionStatement(superMethodInvocation);
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "super.bar();", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * MessageSend ==> SuperMethodInvocation
-// */
-// public void test0079() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0079", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// SuperMethodInvocation superMethodInvocation = this.ast.newSuperMethodInvocation();
-// superMethodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$
-// superMethodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$
-// ExpressionStatement statement = this.ast.newExpressionStatement(superMethodInvocation);
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "super.bar(4);", source); //$NON-NLS-1$
-// }
-
- /**
- * MessageSend ==> FunctionInvocation
- */
- public void test0080() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0080", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- FunctionInvocation methodInvocation = this.ast.newFunctionInvocation();
- methodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$
- methodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(methodInvocation);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "bar(4);", source); //$NON-NLS-1$
- }
-
- /**
- * MessageSend ==> FunctionInvocation
- */
- public void test0081() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0081", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- FunctionInvocation methodInvocation = this.ast.newFunctionInvocation();
- methodInvocation.setName(this.ast.newSimpleName("bar")); //$NON-NLS-1$
- methodInvocation.setExpression(this.ast.newThisExpression());
- methodInvocation.arguments().add(this.ast.newNumberLiteral("4"));//$NON-NLS-1$
- ExpressionStatement statement = this.ast.newExpressionStatement(methodInvocation);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "this.bar(4);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0082() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0082", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (;;);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- * @deprecated using deprecated code
- */
- public void test0083() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0083", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setModifiers(Modifier.NONE);
-// variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- forStatement.initializers().add(variableDeclarationExpression);
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- forStatement.setBody(this.ast.newBlock());
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$
- forStatement.setExpression(infixExpression);
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (var i = 0; i < 10; i++) {}", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- * @deprecated using deprecated code
- */
- public void test0084() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0084", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
-
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setModifiers(Modifier.NONE);
-// variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- forStatement.initializers().add(variableDeclarationExpression);
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$
- forStatement.setExpression(infixExpression);
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (var i = 0; i < 10; i++);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- * @deprecated using deprecated code
- */
- public void test0085() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0085", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
-
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setModifiers(Modifier.NONE);
-// variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-
- forStatement.initializers().add(variableDeclarationExpression);
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (var i = 0;; i++);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0086() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0086", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$
- forStatement.setExpression(infixExpression);
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (; i < 10; i++);", source); //$NON-NLS-1$
- }
-
- /**
- * ForStatement ==> ForStatement
- */
- public void test0087() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0087", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- forStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (;;i++);", source); //$NON-NLS-1$
- }
-
- /**
- * LocalDeclaration ==> VariableDeclarationStatement
- * @deprecated using deprecated code
- */
- public void test0088() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0088", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
-
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- statement.setModifiers(Modifier.NONE);
-
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var i;", source); //$NON-NLS-1$
- }
-
-// /**
-// * LocalDeclaration ==> VariableDeclarationStatement
-// * @deprecated using deprecated code
-// */
-// public void test0089() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0089", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-//
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$
-//
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// QualifiedName name =
-// this.ast.newQualifiedName(
-// this.ast.newQualifiedName(
-// this.ast.newSimpleName("java"),//$NON-NLS-1$
-// this.ast.newSimpleName("lang")//$NON-NLS-1$
-// ),
-// this.ast.newSimpleName("String") //$NON-NLS-1$
-// );
-// statement.setType(this.ast.newSimpleType(name));
-// statement.setModifiers(Modifier.NONE);
-//
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "java.lang.String s;", source); //$NON-NLS-1$
-// }
-
- /**
- * LocalDeclaration ==> VariableDeclarationStatement
- * @deprecated using deprecated code
- */
- public void test0090() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0090", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- ArrayInitializer initializer = this.ast.newArrayInitializer();
- initializer.expressions().add(this.ast.newNumberLiteral("1"));//$NON-NLS-1$
- initializer.expressions().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- variableDeclarationFragment.setInitializer(initializer);
- variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$
-
- VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(variableDeclarationFragment);
-// statement.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1));
- statement.setModifiers(Modifier.NONE);
- assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var tab = [1, 2];", source); //$NON-NLS-1$
- }
-
- /**
- * Argument ==> SingleVariableDeclaration
- * @deprecated using deprecated code
- */
- public void test0091() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0091", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- FunctionDeclaration method = (FunctionDeclaration) ((JavaScriptUnit) result).statements().get(0);
- SingleVariableDeclaration node = (SingleVariableDeclaration) method.parameters().get(0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration();
- variableDeclaration.setModifiers(Modifier.NONE);
-// variableDeclaration.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
- variableDeclaration.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", variableDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "s", source); //$NON-NLS-1$
- }
-
- /**
- * Argument ==> SingleVariableDeclaration
- * @deprecated using deprecated code
- */
-// public void test0092() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0092", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// FunctionDeclaration method = (FunctionDeclaration)((TypeDeclaration) ((JavaScriptUnit) result).types().get(0)).bodyDeclarations().get(0);
-// SingleVariableDeclaration node = (SingleVariableDeclaration) method.parameters().get(0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// SingleVariableDeclaration variableDeclaration = this.ast.newSingleVariableDeclaration();
-// variableDeclaration.setModifiers(Modifier.FINAL);
-// variableDeclaration.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
-// variableDeclaration.setName(this.ast.newSimpleName("s")); //$NON-NLS-1$
-// assertTrue("Both AST trees should be identical", variableDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "final String s", source); //$NON-NLS-1$
-// assertEquals("Wrong dimension", 0, node.getExtraDimensions()); //$NON-NLS-1$
-// }
-
- /**
- * Break ==> BreakStatement
- */
- public void test0093() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0093", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- ForStatement forStatement = (ForStatement) node;
- BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- BreakStatement breakStatement = this.ast.newBreakStatement();
- assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "break;", source); //$NON-NLS-1$
- }
-
- /**
- * Continue ==> ContinueStatement
- */
- public void test0094() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0094", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- ForStatement forStatement = (ForStatement) node;
- ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- ContinueStatement continueStatement = this.ast.newContinueStatement();
- assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "continue;", source); //$NON-NLS-1$
- }
-
- /**
- * Continue with Label ==> ContinueStatement
- */
- public void test0095() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0095", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0);
- ForStatement forStatement = (ForStatement) labeledStatement.getBody();
- ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- ContinueStatement continueStatement = this.ast.newContinueStatement();
- continueStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "continue label;", source); //$NON-NLS-1$
- }
-
- /**
- * Break + label ==> BreakStatement
- */
- public void test0096() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0096", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0);
- ForStatement forStatement = (ForStatement) labeledStatement.getBody();
- BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- BreakStatement breakStatement = this.ast.newBreakStatement();
- breakStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "break label;", source); //$NON-NLS-1$
- }
-
- /**
- * SwitchStatement ==> SwitchStatement
- */
- public void test0097() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0097", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- SwitchStatement switchStatement = this.ast.newSwitchStatement();
- switchStatement.setExpression(this.ast.newSimpleName("i"));//$NON-NLS-1$
- SwitchCase _case = this.ast.newSwitchCase();
- _case.setExpression(this.ast.newNumberLiteral("1"));//$NON-NLS-1$
- switchStatement.statements().add(_case);
- switchStatement.statements().add(this.ast.newBreakStatement());
- _case = this.ast.newSwitchCase();
- _case.setExpression(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- switchStatement.statements().add(_case);
- FunctionInvocation methodInvocation = this.ast.newFunctionInvocation();
-// QualifiedName name =
-// this.ast.newQualifiedName(
-// this.ast.newSimpleName("System"),//$NON-NLS-1$
-// this.ast.newSimpleName("out"));//$NON-NLS-1$
-// methodInvocation.setExpression(name);
- FieldAccess fieldAccess = this.ast.newFieldAccess();
- fieldAccess.setExpression(this.ast.newSimpleName("System"));
- fieldAccess.setName(this.ast.newSimpleName("out"));
- methodInvocation.setExpression(fieldAccess);
- methodInvocation.setName(this.ast.newSimpleName("println")); //$NON-NLS-1$
- methodInvocation.arguments().add(this.ast.newNumberLiteral("2"));//$NON-NLS-1$
- ExpressionStatement expressionStatement = this.ast.newExpressionStatement(methodInvocation);
- switchStatement.statements().add(expressionStatement);
- switchStatement.statements().add(this.ast.newBreakStatement());
- _case = this.ast.newSwitchCase();
- _case.setExpression(null);
- switchStatement.statements().add(_case);
- methodInvocation = this.ast.newFunctionInvocation();
-// name =
-// this.ast.newQualifiedName(
-// this.ast.newSimpleName("System"),//$NON-NLS-1$
-// this.ast.newSimpleName("out"));//$NON-NLS-1$
-// methodInvocation.setExpression(name);
- fieldAccess = this.ast.newFieldAccess();
- fieldAccess.setExpression(this.ast.newSimpleName("System"));
- fieldAccess.setName(this.ast.newSimpleName("out"));
- methodInvocation.setExpression(fieldAccess);
- methodInvocation.setName(this.ast.newSimpleName("println")); //$NON-NLS-1$
- StringLiteral literal = this.ast.newStringLiteral();
- literal.setLiteralValue("default"); //$NON-NLS-1$
- methodInvocation.arguments().add(literal);
- expressionStatement = this.ast.newExpressionStatement(methodInvocation);
- switchStatement.statements().add(expressionStatement);
- assertTrue("Both AST trees should be identical", switchStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "switch(i) {\n" +//$NON-NLS-1$
- " case 1: \n" +//$NON-NLS-1$
- " break;\n" +//$NON-NLS-1$
- " case 2:\n" +//$NON-NLS-1$
- " System.out.println(2);\n" +//$NON-NLS-1$
- " break;\n" +//$NON-NLS-1$
- " default:\n" +//$NON-NLS-1$
- " System.out.println(\"default\");\n" +//$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- SwitchStatement switchStatement2 = (SwitchStatement) node;
- List statements = switchStatement2.statements();
- assertEquals("wrong size", 7, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(5);
- assertTrue("Not a case statement", stmt instanceof SwitchCase); //$NON-NLS-1$
- SwitchCase switchCase = (SwitchCase) stmt;
- assertTrue("Not the default case", switchCase.isDefault()); //$NON-NLS-1$
- }
-
- /**
- * EmptyStatement ==> EmptyStatement
- */
- public void test0098() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0098", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- EmptyStatement emptyStatement = this.ast.newEmptyStatement();
- assertTrue("Both AST trees should be identical", emptyStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, ";", source); //$NON-NLS-1$
- }
-
- /**
- * DoStatement ==> DoStatement
- */
- public void test0099() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0099", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- DoStatement doStatement = this.ast.newDoStatement();
- Block block = this.ast.newBlock();
- block.statements().add(this.ast.newEmptyStatement());
- doStatement.setBody(block);
- doStatement.setExpression(this.ast.newBooleanLiteral(true));
- assertTrue("Both AST trees should be identical", doStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "do {;\n" +//$NON-NLS-1$
- " } while(true);";//$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * WhileStatement ==> WhileStatement
- */
- public void test0100() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0100", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- WhileStatement whileStatement = this.ast.newWhileStatement();
- whileStatement.setExpression(this.ast.newBooleanLiteral(true));
- whileStatement.setBody(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", whileStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "while(true);", source);//$NON-NLS-1$
- }
-
- /**
- * WhileStatement ==> WhileStatement
- */
- public void test0101() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0101", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- WhileStatement whileStatement = this.ast.newWhileStatement();
- whileStatement.setExpression(this.ast.newBooleanLiteral(true));
- whileStatement.setBody(this.ast.newBlock());
- assertTrue("Both AST trees should be identical", whileStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "while(true) {}", source);//$NON-NLS-1$
- }
-
- /**
- * ExtendedStringLiteral ==> StringLiteral
- */
- public void test0102() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0102", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("Hello"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue(" World"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("!"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\"", source);//$NON-NLS-1$
- }
-
- /**
- * ExtendedStringLiteral ==> StringLiteral
- */
- public void test0103() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0103", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("Hello"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue(" World"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("!"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("!"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\" + \"!\"", source);//$NON-NLS-1$
- }
-
- /**
- * ExtendedStringLiteral ==> StringLiteral
- */
- public void test0104() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0104", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("Hello"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue(" World"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newStringLiteral();//$NON-NLS-1$
- literal.setLiteralValue("!"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- NumberLiteral numberLiteral = this.ast.newNumberLiteral();//$NON-NLS-1$
- numberLiteral.setToken("4"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(numberLiteral);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"Hello\" + \" World\" + \"!\" + 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0105() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0105", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "4 + 5 + 6 + 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0106() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0106", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.MINUS);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
-
- InfixExpression infixExpression2 = this.ast.newInfixExpression();
- infixExpression2.setOperator(InfixExpression.Operator.PLUS);
- infixExpression2.setLeftOperand(infixExpression);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression2.setRightOperand(literal);
-
- InfixExpression infixExpression3 = this.ast.newInfixExpression();
- infixExpression3.setOperator(InfixExpression.Operator.PLUS);
- infixExpression3.setLeftOperand(infixExpression2);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression3.setRightOperand(literal);
-
- assertTrue("Both AST trees should be identical", infixExpression3.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "4 - 5 + 6 + 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0107() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0107", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.MINUS);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "4 - 5 - 6 - 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0108() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0108", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.PLUS);
- StringLiteral stringLiteral = this.ast.newStringLiteral();//$NON-NLS-1$
- stringLiteral.setLiteralValue("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(stringLiteral);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression.extendedOperands().add(literal);
- assertTrue("Both AST trees should be identical", infixExpression.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"4\" + 5 + 6 + 4", source);//$NON-NLS-1$
- }
-
- /**
- * NumberLiteral ==> InfixExpression
- */
- public void test0109() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0109", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
- assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setOperator(InfixExpression.Operator.MINUS);
- StringLiteral stringLiteral = this.ast.newStringLiteral();//$NON-NLS-1$
- stringLiteral.setLiteralValue("4"); //$NON-NLS-1$
- infixExpression.setLeftOperand(stringLiteral);
- NumberLiteral literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("5"); //$NON-NLS-1$
- infixExpression.setRightOperand(literal);
-
- InfixExpression infixExpression2 = this.ast.newInfixExpression();
- infixExpression2.setOperator(InfixExpression.Operator.PLUS);
- infixExpression2.setLeftOperand(infixExpression);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("6"); //$NON-NLS-1$
- infixExpression2.setRightOperand(literal);
-
- InfixExpression infixExpression3 = this.ast.newInfixExpression();
- infixExpression3.setOperator(InfixExpression.Operator.PLUS);
- infixExpression3.setLeftOperand(infixExpression2);
- literal = this.ast.newNumberLiteral();//$NON-NLS-1$
- literal.setToken("4"); //$NON-NLS-1$
- infixExpression3.setRightOperand(literal);
-
- assertTrue("Both AST trees should be identical", infixExpression3.subtreeMatch(new ASTMatcher(), expression)); //$NON-NLS-1$
- checkSourceRange(expression, "\"4\" - 5 + 6 + 4", source);//$NON-NLS-1$
- }
-
- /**
- * ReturnStatement ==> ReturnStatement
- */
- public void test0110() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0110", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- assertTrue("Both AST trees should be identical", returnStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "return 2;", source);//$NON-NLS-1$
- }
-
- /**
- * ReturnStatement ==> ReturnStatement
- */
- public void test0111() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0111", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- assertTrue("Both AST trees should be identical", returnStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "return 2\\u003B", source);//$NON-NLS-1$
- }
-
-// /**
-// * SynchronizedStatement ==> SynchronizedStatement
-// */
-// public void test0112() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0112", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// SynchronizedStatement synchronizedStatement = this.ast.newSynchronizedStatement();
-// synchronizedStatement.setExpression(this.ast.newThisExpression());
-// synchronizedStatement.setBody(this.ast.newBlock());
-// assertTrue("Both AST trees should be identical", synchronizedStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// String expectedSource = "synchronized(this) {\n" +//$NON-NLS-1$
-// " }"; //$NON-NLS-1$
-// checkSourceRange(node, expectedSource, source);
-// }
-
- /**
- * TryStatement ==> TryStatement
- * @deprecated using deprecated code
- */
- public void test0113() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0113", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- TryStatement tryStatement = this.ast.newTryStatement();
- tryStatement.setBody(this.ast.newBlock());
- tryStatement.setFinally(this.ast.newBlock());
- CatchClause catchBlock = this.ast.newCatchClause();
- catchBlock.setBody(this.ast.newBlock());
- SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration();
- exceptionVariable.setModifiers(Modifier.NONE);
- exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$
-// exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$
- catchBlock.setException(exceptionVariable);
- tryStatement.catchClauses().add(catchBlock);
- assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "try {\n" +//$NON-NLS-1$
- " } catch( e) {\n" +//$NON-NLS-1$
- " } finally {\n" +//$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * TryStatement ==> TryStatement
- * @deprecated using deprecated code
- */
- public void test0114() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0114", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- TryStatement tryStatement = this.ast.newTryStatement();
- tryStatement.setBody(this.ast.newBlock());
- CatchClause catchBlock = this.ast.newCatchClause();
- catchBlock.setBody(this.ast.newBlock());
- SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration();
- exceptionVariable.setModifiers(Modifier.NONE);
- exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$
-// exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$
- catchBlock.setException(exceptionVariable);
- tryStatement.catchClauses().add(catchBlock);
- assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "try {\n" +//$NON-NLS-1$
- " } catch(e) {\n" +//$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * TryStatement ==> TryStatement
- * @deprecated using deprecated code
- */
- public void test0115() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0115", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- TryStatement tryStatement = this.ast.newTryStatement();
- Block block = this.ast.newBlock();
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- block.statements().add(returnStatement);
- tryStatement.setBody(block);
- CatchClause catchBlock = this.ast.newCatchClause();
- catchBlock.setBody(this.ast.newBlock());
- SingleVariableDeclaration exceptionVariable = this.ast.newSingleVariableDeclaration();
- exceptionVariable.setModifiers(Modifier.NONE);
- exceptionVariable.setName(this.ast.newSimpleName("e"));//$NON-NLS-1$
-// exceptionVariable.setType(this.ast.newSimpleType(this.ast.newSimpleName("Exception")));//$NON-NLS-1$
- catchBlock.setException(exceptionVariable);
- tryStatement.catchClauses().add(catchBlock);
- assertTrue("Both AST trees should be identical", tryStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "try {\n" +//$NON-NLS-1$
- " return 2;\n" +//$NON-NLS-1$
- " } catch(e) {\n" +//$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * ThrowStatement ==> ThrowStatement
- */
- public void test0116() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0116", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ThrowStatement throwStatement = this.ast.newThrowStatement();
- throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "throw e \\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * ThrowStatement ==> ThrowStatement
- */
- public void test0117() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0117", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ThrowStatement throwStatement = this.ast.newThrowStatement();
- throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "throw e /* comment in the middle of a throw */ \\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * ThrowStatement ==> ThrowStatement
- */
- public void test0118() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0118", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ThrowStatement throwStatement = this.ast.newThrowStatement();
- throwStatement.setExpression(this.ast.newSimpleName("e")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", throwStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "throw e /* comment in the middle of a throw */ \\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0119() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0119", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ifStatement.setThenStatement(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "if (true)\\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0120() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0120", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ifStatement.setThenStatement(this.ast.newEmptyStatement());
- ifStatement.setElseStatement(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "if (true)\\u003B\n" +//$NON-NLS-1$
- "\t\telse ;"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0121() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0121", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ifStatement.setThenStatement(this.ast.newBlock());
- ifStatement.setElseStatement(this.ast.newEmptyStatement());
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "if (true) {}\n" +//$NON-NLS-1$
- " else ;"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0122() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0122", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- ifStatement.setThenStatement(returnStatement);
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "if (true) return 2\\u003B", source);//$NON-NLS-1$
- }
-
- /**
- * IfStatement ==> IfStatement
- */
- public void test0123() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0123", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- IfStatement ifStatement = this.ast.newIfStatement();
- ifStatement.setExpression(this.ast.newBooleanLiteral(true));
- ReturnStatement returnStatement = this.ast.newReturnStatement();
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("2");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- ifStatement.setThenStatement(returnStatement);
- returnStatement = this.ast.newReturnStatement();
- literal = this.ast.newNumberLiteral();
- literal.setToken("3");//$NON-NLS-1$
- returnStatement.setExpression(literal);
- ifStatement.setElseStatement(returnStatement);
- assertTrue("Both AST trees should be identical", ifStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "if (true) return 2;\n" +//$NON-NLS-1$
- " else return 3;"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * Multiple local declaration => VariabledeclarationStatement
- * @deprecated using deprecated code
- */
-// public void test0124() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0124", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment();
-// fragment.setName(this.ast.newSimpleName("x"));//$NON-NLS-1$
-// NumberLiteral literal = this.ast.newNumberLiteral();
-// literal.setToken("10");//$NON-NLS-1$
-// fragment.setInitializer(literal);
-// fragment.setExtraDimensions(0);
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(fragment);
-// fragment = this.ast.newVariableDeclarationFragment();
-// fragment.setName(this.ast.newSimpleName("z"));//$NON-NLS-1$
-// fragment.setInitializer(this.ast.newNullLiteral());
-// fragment.setExtraDimensions(1);
-// statement.fragments().add(fragment);
-// fragment = this.ast.newVariableDeclarationFragment();
-// fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$
-// fragment.setExtraDimensions(0);
-// statement.fragments().add(fragment);
-// fragment = this.ast.newVariableDeclarationFragment();
-// fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$
-// fragment.setExtraDimensions(2);
-// statement.fragments().add(fragment);
-// statement.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-// statement.setModifiers(Modifier.NONE);
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((VariableDeclarationStatement) node).fragments().toArray(new VariableDeclarationFragment[4]);
-// assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$
-// checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$
-// checkSourceRange(fragments[1], "z[] = null", source);//$NON-NLS-1$
-// checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$
-// checkSourceRange(fragments[3], "j[][]", source);//$NON-NLS-1$
-// checkSourceRange(node, "int x= 10, z[] = null, i, j[][];", source);//$NON-NLS-1$
-// }
-//
-// /**
-// * Multiple local declaration => VariabledeclarationStatement
-// * @deprecated using deprecated code
-// */
-// public void test0125() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0125", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment();
-// fragment.setName(this.ast.newSimpleName("x"));//$NON-NLS-1$
-// NumberLiteral literal = this.ast.newNumberLiteral();
-// literal.setToken("10");//$NON-NLS-1$
-// fragment.setInitializer(literal);
-// fragment.setExtraDimensions(0);
-// VariableDeclarationStatement statement = this.ast.newVariableDeclarationStatement(fragment);
-// fragment = this.ast.newVariableDeclarationFragment();
-// fragment.setName(this.ast.newSimpleName("z"));//$NON-NLS-1$
-// fragment.setInitializer(this.ast.newNullLiteral());
-// fragment.setExtraDimensions(1);
-// statement.fragments().add(fragment);
-// fragment = this.ast.newVariableDeclarationFragment();
-// fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$
-// fragment.setExtraDimensions(0);
-// statement.fragments().add(fragment);
-// fragment = this.ast.newVariableDeclarationFragment();
-// fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$
-// fragment.setExtraDimensions(2);
-// statement.fragments().add(fragment);
-// statement.setType(this.ast.newArrayType(this.ast.newPrimitiveType(PrimitiveType.INT), 1));
-// statement.setModifiers(Modifier.NONE);
-// assertTrue("Both AST trees should be identical", statement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "int[] x= 10, z[] = null, i, j[][];", source); //$NON-NLS-1$
-// VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((VariableDeclarationStatement) node).fragments().toArray(new VariableDeclarationFragment[4]);
-// assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$
-// checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$
-// checkSourceRange(fragments[1], "z[] = null", source);//$NON-NLS-1$
-// checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$
-// checkSourceRange(fragments[3], "j[][]", source);//$NON-NLS-1$
-// }
-//
-// /**
-// * ForStatement
-// * @deprecated using deprecated code
-// */
-// public void test0126() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0126", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// ForStatement forStatement = this.ast.newForStatement();
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$
-// variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$
-// variableDeclarationFragment.setExtraDimensions(1);
-// VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
-// variableDeclarationExpression.setModifiers(Modifier.NONE);
-// variableDeclarationExpression.setType(this.ast.newArrayType(this.ast.newSimpleType(this.ast.newSimpleName("String")), 1));//$NON-NLS-1$
-// forStatement.initializers().add(variableDeclarationExpression);
-// PrefixExpression prefixExpression = this.ast.newPrefixExpression();
-// prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
-// prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT);
-// forStatement.updaters().add(prefixExpression);
-// forStatement.setBody(this.ast.newBlock());
-// assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "for (String[] tab[] = null;; ++i) {}", source); //$NON-NLS-1$
-// checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "++i", source); //$NON-NLS-1$
-// checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "String[] tab[] = null", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * ForStatement
-// * @deprecated using deprecated code
-// */
-// public void test0127() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0127", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// ForStatement forStatement = this.ast.newForStatement();
-// VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
-// variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$
-// variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$
-// variableDeclarationFragment.setExtraDimensions(1);
-// VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
-// variableDeclarationExpression.setModifiers(Modifier.NONE);
-// variableDeclarationExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
-// forStatement.initializers().add(variableDeclarationExpression);
-// PrefixExpression prefixExpression = this.ast.newPrefixExpression();
-// prefixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
-// prefixExpression.setOperator(PrefixExpression.Operator.INCREMENT);
-// forStatement.updaters().add(prefixExpression);
-// forStatement.setBody(this.ast.newBlock());
-// assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
-// checkSourceRange(node, "for (String tab[] = null;; ++i) {}", source); //$NON-NLS-1$
-// checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "++i", source); //$NON-NLS-1$
-// checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "String tab[] = null", source); //$NON-NLS-1$
-// }
-//
- /**
- * ForStatement
- * @deprecated using deprecated code
- */
- public void test0128() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0128", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
- VariableDeclarationFragment variableDeclarationFragment = this.ast.newVariableDeclarationFragment();
- variableDeclarationFragment.setName(this.ast.newSimpleName("tab")); //$NON-NLS-1$
- variableDeclarationFragment.setInitializer(this.ast.newNullLiteral());//$NON-NLS-1$
-// variableDeclarationFragment.setExtraDimensions(1);
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(variableDeclarationFragment);
- variableDeclarationExpression.setModifiers(Modifier.NONE);
-// variableDeclarationExpression.setType(this.ast.newSimpleType(this.ast.newSimpleName("String")));//$NON-NLS-1$
- forStatement.initializers().add(variableDeclarationExpression);
- PostfixExpression postfixExpression = this.ast.newPostfixExpression();
- postfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- postfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(postfixExpression);
- forStatement.setBody(this.ast.newBlock());
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (var tab = null;; i++/**/) {}", source); //$NON-NLS-1$
- checkSourceRange((ASTNode) ((ForStatement) node).updaters().get(0), "i++", source); //$NON-NLS-1$
- checkSourceRange((ASTNode) ((ForStatement) node).initializers().get(0), "var tab = null", source); //$NON-NLS-1$
- }
-
- /**
- * VariableDeclarationStatement
- * @deprecated using deprecated code
- */
- public void test0129() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0129", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationFragment frag = (VariableDeclarationFragment) ((VariableDeclarationStatement) node).fragments().get(0);
- assertTrue("Not a declaration", frag.getName().isDeclaration()); //$NON-NLS-1$
-
- VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
-
-
- VariableDeclarationStatement var = this.ast.newVariableDeclarationStatement(fragment);
-// fragment.setExtraDimensions(0);
-// VariableDeclarationStatement fieldDeclaration = this.ast.newVariableDeclarationStatement(fragment);
-// fieldDeclaration.setModifiers(Modifier.NONE);
-// fieldDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- assertTrue("Both AST trees should be identical", var.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var i;", source); //$NON-NLS-1$
- }
-
- /**
- * VariableDeclarationStatement
- * @deprecated using deprecated code
- */
- public void test0130() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0130", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationFragment fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("x")); //$NON-NLS-1$
- NumberLiteral literal = this.ast.newNumberLiteral();
- literal.setToken("10"); //$NON-NLS-1$
- fragment.setInitializer(literal);
-// fragment.setExtraDimensions(0);
- VariableDeclarationStatement variableDeclaration = this.ast.newVariableDeclarationStatement(fragment);
-// variableDeclaration.setModifiers(Modifier.PUBLIC);
-// fieldDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("y"));//$NON-NLS-1$
-// fragment.setExtraDimensions(1);
- fragment.setInitializer(this.ast.newNullLiteral());
- variableDeclaration.fragments().add(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("i"));//$NON-NLS-1$
-// fragment.setExtraDimensions(0);
- variableDeclaration.fragments().add(fragment);
- fragment = this.ast.newVariableDeclarationFragment();
- fragment.setName(this.ast.newSimpleName("j"));//$NON-NLS-1$
-// fragment.setExtraDimensions(2);
- variableDeclaration.fragments().add(fragment);
- assertTrue("Both AST trees should be identical", variableDeclaration.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "var x= 10, y = null, i, j;", source); //$NON-NLS-1$
- VariableDeclarationFragment[] fragments = (VariableDeclarationFragment[])((VariableDeclarationStatement) node).fragments().toArray(new VariableDeclarationFragment[4]);
- assertTrue("fragments.length != 4", fragments.length == 4); //$NON-NLS-1$
- checkSourceRange(fragments[0], "x= 10", source);//$NON-NLS-1$
- checkSourceRange(fragments[1], "y = null", source);//$NON-NLS-1$
- checkSourceRange(fragments[2], "i", source);//$NON-NLS-1$
- checkSourceRange(fragments[3], "j", source);//$NON-NLS-1$
- }
-
-// /**
-// * Argument with final modifier
-// * @deprecated using deprecated code
-// */
-// public void test0131() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0131", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
-// assertTrue("Not a declaration", ((FunctionDeclaration) node).getName().isDeclaration()); //$NON-NLS-1$
-// List parameters = ((FunctionDeclaration) node).parameters();
-// assertTrue("Parameters.length != 1", parameters.size() == 1); //$NON-NLS-1$
-// SingleVariableDeclaration arg = (SingleVariableDeclaration) ((FunctionDeclaration) node).parameters().get(0);
-// SingleVariableDeclaration singleVariableDeclaration = this.ast.newSingleVariableDeclaration();
-// singleVariableDeclaration.setModifiers(Modifier.FINAL);
-// singleVariableDeclaration.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
-// singleVariableDeclaration.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
-// assertTrue("Both AST trees should be identical", singleVariableDeclaration.subtreeMatch(new ASTMatcher(), arg)); //$NON-NLS-1$
-// checkSourceRange(node, "void foo(final int i) {}", source); //$NON-NLS-1$
-// checkSourceRange(arg, "final int i", source); //$NON-NLS-1$
-// }
-
- /**
- * Check javadoc for FunctionDeclaration
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0132() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0132", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc();
- JSdoc javadoc = this.ast.newJSdoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- checkSourceRange(node, "/** JavaDoc Comment*/\n function foo(i) {}", source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FunctionDeclaration
- */
- public void test0133() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0133", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "function foo(i) {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FunctionDeclaration
- */
- public void test0134() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0134", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "function foo( i) {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for VariableDeclarationStatement
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0135() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0135", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- JSdoc actualJavadoc = ((VariableDeclarationStatement) node).getJavadoc();
- JSdoc javadoc = this.ast.newJSdoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- checkSourceRange(node, "/** JavaDoc Comment*/\n var i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for VariableDeclarationStatement
- */
- public void test0136() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0136", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- JSdoc actualJavadoc = ((VariableDeclarationStatement) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "var i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for VariableDeclarationStatement
- */
- public void test0137() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0137", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- JSdoc actualJavadoc = ((VariableDeclarationStatement) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "var i;", source); //$NON-NLS-1$
- }
-
-// /**
-// * Check javadoc for TypeDeclaration
-// */
-// public void test0138() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0138", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
-// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
-// String expectedContents = "public class Test {\n" +//$NON-NLS-1$
-// " int i;\n" +//$NON-NLS-1$
-// "}";//$NON-NLS-1$
-// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Check javadoc for TypeDeclaration
-// */
-// public void test0139() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0139", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
-// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
-// String expectedContents = "public class Test {\n" +//$NON-NLS-1$
-// " int i;\n" +//$NON-NLS-1$
-// "}";//$NON-NLS-1$
-// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Check javadoc for TypeDeclaration
-// * @deprecated marking deprecated since using deprecated code
-// */
-// public void test0140() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0140", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
-// Javadoc javadoc = this.ast.newJavadoc();
-// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
-// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
-// String expectedContents =
-// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
-// "public class Test {\n" +//$NON-NLS-1$
-// " int i;\n" +//$NON-NLS-1$
-// "}";//$NON-NLS-1$
-// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
-// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-// }
-
-// /**
-// * Check javadoc for MemberTypeDeclaration
-// * @deprecated marking deprecated since using deprecated code
-// */
-// public void test0141() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0141", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
-// Javadoc javadoc = this.ast.newJavadoc();
-// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
-// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
-// String expectedContents =
-// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
-// " class B {}";//$NON-NLS-1$
-// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
-// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Check javadoc for MemberTypeDeclaration
-// */
-// public void test0142() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0142", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
-// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
-// checkSourceRange(node, "class B {}", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Check javadoc for MemberTypeDeclaration
-// */
-// public void test0143() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0143", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
-// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
-// checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Check javadoc for MemberTypeDeclaration
-// */
-// public void test0144() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0144", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
-// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
-// checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$
-// }
-
-// /**
-// * Checking initializers
-// */
-// public void test0145() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0145", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// checkSourceRange(node, "{}", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Checking initializers
-// */
-// public void test0146() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0146", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// checkSourceRange(node, "static {}", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Checking initializers
-// * @deprecated marking deprecated since using deprecated code
-// */
-// public void test0147() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0147", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((Initializer) node).getJavadoc();
-// assertNotNull("Javadoc comment should no be null", actualJavadoc); //$NON-NLS-1$
-// Javadoc javadoc = this.ast.newJavadoc();
-// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
-// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
-// String expectedContents =
-// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
-// " static {}";//$NON-NLS-1$
-// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
-// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-//
-// }
-//
-// /**
-// * Checking initializers
-// * @deprecated marking deprecated since using deprecated code
-// */
-// public void test0148() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0148", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((Initializer) node).getJavadoc();
-// assertNotNull("Javadoc comment should not be null", actualJavadoc); //$NON-NLS-1$
-// Javadoc javadoc = this.ast.newJavadoc();
-// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
-// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
-// String expectedContents =
-// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
-// " {}";//$NON-NLS-1$
-// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
-// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-//
-// }
-//
-// /**
-// * Checking initializers
-// */
-// public void test0149() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0149", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((Initializer) node).getJavadoc();
-// assertNull("Javadoc comment should be null", actualJavadoc); //$NON-NLS-1$
-// checkSourceRange(node, "{}", source); //$NON-NLS-1$
-// }
-
- /**
- * Checking syntax error
- */
- public void test0150() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0150", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertTrue("The compilation unit is malformed", !isMalformed(unit)); //$NON-NLS-1$
-// assertTrue("The package declaration is not malformed", isMalformed(unit.getPackage())); //$NON-NLS-1$
-// List imports = unit.imports();
-// assertTrue("The imports list size is not one", imports.size() == 1); //$NON-NLS-1$
-// assertTrue("The first import is malformed", !isMalformed((ASTNode) imports.get(0))); //$NON-NLS-1$
- }
-
-// /**
-// * Checking syntax error
-// */
-// public void test0151() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0151", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, false);
-// assertNotNull("Expression should not be null", result); //$NON-NLS-1$
-// assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$
-// }
-
- /**
- * Checking syntax error
- */
- public void test0152() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0152", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The type is malformed", !isMalformed(node)); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The field is not malformed", isMalformed(node)); //$NON-NLS-1$
-// node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The method is not malformed", isMalformed(node)); //$NON-NLS-1$
- }
-
- /**
- * Checking syntax error
- */
- public void test0153() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0153", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The method is not original", isOriginal(node)); //$NON-NLS-1$
- assertTrue("The method is not malformed", isMalformed(node)); //$NON-NLS-1$
- }
-//
-// /**
-// * Checking binding of package declaration
-// */
-// public void test0154() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0154", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("Expression should not be null", result); //$NON-NLS-1$
-// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// IBinding binding = compilationUnit.getPackage().getName().resolveBinding();
-// assertNotNull("The package binding is null", binding); //$NON-NLS-1$
-// assertTrue("The binding is not a package binding", binding instanceof IPackageBinding); //$NON-NLS-1$
-// IPackageBinding packageBinding = (IPackageBinding) binding;
-// assertEquals("The package name is incorrect", "test0154", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// IBinding binding2 = compilationUnit.getPackage().getName().resolveBinding();
-// assertTrue("The package binding is not canonical", binding == binding2); //$NON-NLS-1$
-// }
-
- /**
- * Checking arguments positions
- */
- public void test0155() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0155", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("The result is not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDecl = (FunctionDeclaration) node;
- List parameters = methodDecl.parameters();
- assertTrue("The parameters size is different from 2", parameters.size() == 2); //$NON-NLS-1$
- Object parameter = parameters.get(0);
- assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$
- checkSourceRange((ASTNode) parameter, "i", source); //$NON-NLS-1$
- parameter = parameters.get(1);
- assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$
- checkSourceRange((ASTNode) parameter, "b", source); //$NON-NLS-1$
- }
-
- /**
- * Checking arguments positions
- */
- public void test0156() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0156", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("The result is not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDecl = (FunctionDeclaration) node;
- List parameters = methodDecl.parameters();
- assertTrue("The parameters size is different from 1", parameters.size() == 1); //$NON-NLS-1$
- Object parameter = parameters.get(0);
- assertTrue("The parameter is not a SingleVariableDeclaration", parameter instanceof SingleVariableDeclaration); //$NON-NLS-1$
- checkSourceRange((ASTNode) parameter, "i", source); //$NON-NLS-1$
- Block block = methodDecl.getBody();
- List statements = block.statements();
- assertTrue("The statements size is different from 2", statements.size() == 2); //$NON-NLS-1$
- ASTNode statement = (ASTNode) statements.get(0);
- assertTrue("The statements[0] is a postfixExpression statement", statement instanceof ExpressionStatement); //$NON-NLS-1$
- }
-
- /**
- * Check canonic binding for fields
- */
- public void test0157() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test0157.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- List statements = compilationUnit.statements();
- assertTrue("The types list is empty", statements.size() != 0); //$NON-NLS-1$
-// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
-// ITypeBinding typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$
-// assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$
-// List bodyDeclarations = typeDeclaration.bodyDeclarations();
-// assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$
- Statement bodyDeclaration = (Statement) statements.get(0);
- assertTrue("This is not a field", bodyDeclaration instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) bodyDeclaration;
- List variableFragments = fieldDeclaration.fragments();
- assertTrue("The fragment list is empty", variableFragments.size() != 0); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("the field binding is null", variableBinding); //$NON-NLS-1$
- assertTrue("The field binding is not canonical", variableBinding == fragment.resolveBinding()); //$NON-NLS-1$
- ITypeBinding typeBinding = variableBinding.getType();
-// assertTrue("The type is not an array type", typeBinding.isArray()); //$NON-NLS-1$
- assertTrue("The type binding for the field is not canonical", typeBinding == variableBinding.getType()); //$NON-NLS-1$
- SimpleName name = fragment.getName();
- assertTrue("is a declaration", name.isDeclaration()); //$NON-NLS-1$
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong type", IBinding.VARIABLE, binding.getKind()); //$NON-NLS-1$
- assertTrue("is a field", !((IVariableBinding) binding).isField()); //$NON-NLS-1$
- }
-
- /**
- * Check canonic bindings for fields
- */
- public void test0158() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test0158.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- List statements = compilationUnit.statements();
- assertTrue("The types list is empty", statements.size() != 0); //$NON-NLS-1$
-// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
-// ITypeBinding typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$
-// assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$
-// SimpleName simpleName = typeDeclaration.getName();
-// assertTrue("is a declaration", simpleName.isDeclaration()); //$NON-NLS-1$
-// IBinding binding = simpleName.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertEquals("wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
-// assertEquals("wrong name", simpleName.getIdentifier(), binding.getName()); //$NON-NLS-1$
-// List bodyDeclarations = typeDeclaration.bodyDeclarations();
-// assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$
- Statement bodyDeclaration = (Statement) statements.get(0);
- assertTrue("This is not a field", bodyDeclaration instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) bodyDeclaration;
- List variableFragments = fieldDeclaration.fragments();
- assertTrue("The fragment list is empty", variableFragments.size() != 0); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("the field binding is null", variableBinding); //$NON-NLS-1$
- assertTrue("The field binding is not canonical", variableBinding == fragment.resolveBinding()); //$NON-NLS-1$
- ITypeBinding typeBinding2 = variableBinding.getType();
-// assertTrue("The type is not an array type", typeBinding2.isArray()); //$NON-NLS-1$
- assertTrue("The type binding for the field is not canonical", typeBinding2 == variableBinding.getType()); //$NON-NLS-1$
-// assertTrue("The type binding for the field is not canonical with the declaration type binding", typeBinding == typeBinding2.getElementType()); //$NON-NLS-1$
- }
-
-// /**
-// * Define an anonymous type
-// */
-// public void test0159() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0159", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("Expression should not be null", result); //$NON-NLS-1$
-// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// }
-
- /**
- * Check bindings for multiple field declarations
- */
- public void test0160() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0160", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- List statements = compilationUnit.statements();
- assertTrue("The statements list is empty", statements.size() != 0); //$NON-NLS-1$
-// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
-// ITypeBinding typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("Type binding is null", typeBinding); //$NON-NLS-1$
-// assertTrue("The type binding is canonical", typeBinding == typeDeclaration.resolveBinding()); //$NON-NLS-1$
-// List bodyDeclarations = typeDeclaration.bodyDeclarations();
-// assertTrue("The body declaration list is empty", bodyDeclarations.size() != 0); //$NON-NLS-1$
- Statement bodyDeclaration = (Statement) statements.get(0);
- assertTrue("This is not a field", bodyDeclaration instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) bodyDeclaration;
- List variableFragments = fieldDeclaration.fragments();
- assertTrue("The fragment list size is not 2", variableFragments.size() == 2); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableFragments.get(0);
- IVariableBinding variableBinding1 = fragment.resolveBinding();
- assertNotNull("the field binding is null", variableBinding1); //$NON-NLS-1$
- assertTrue("The field binding is not canonical", variableBinding1 == fragment.resolveBinding()); //$NON-NLS-1$
- ITypeBinding type1 = variableBinding1.getType();
- assertNotNull("The type is null", type1); //$NON-NLS-1$
- assertTrue("The field type is canonical", type1 == variableBinding1.getType()); //$NON-NLS-1$
-// assertTrue("The type is not an array type",type1.isArray()); //$NON-NLS-1$
-// assertTrue("The type dimension is 1", type1.getDimensions() == 1); //$NON-NLS-1$
- fragment = (VariableDeclarationFragment) variableFragments.get(1);
- IVariableBinding variableBinding2 = fragment.resolveBinding();
- assertNotNull("the field binding is null", variableBinding2); //$NON-NLS-1$
- assertTrue("The field binding is not canonical", variableBinding2 == fragment.resolveBinding()); //$NON-NLS-1$
- ITypeBinding type2 = variableBinding2.getType();
- type2 = variableBinding2.getType();
- assertNotNull("The type is null", type2); //$NON-NLS-1$
- assertTrue("The field type is canonical", type2 == variableBinding2.getType()); //$NON-NLS-1$
-// assertTrue("The type is not an array type",type2.isArray()); //$NON-NLS-1$
-// assertTrue("The type dimension is 2", type2.getDimensions() == 2); //$NON-NLS-1$
-// assertTrue("Element type is canonical", type1.getElementType() == type2.getElementType()); //$NON-NLS-1$
- assertTrue("type1.id < type2.id", variableBinding1.getVariableId() < variableBinding2.getVariableId()); //$NON-NLS-1$
-
- }
-//
-// /**
-// * Check ITypeBinding APIs:
-// * - getModifiers()
-// * - getElementType() when it is not an array type
-// * - getDimensions() when it is not an array type
-// * - getDeclaringClass()
-// * - getDeclaringName()
-// * - getName()
-// * - isNested()
-// * - isAnonymous()
-// * - isLocal()
-// * - isMember()
-// * - isArray()
-// * - getDeclaredMethods() => returns binding for default constructor
-// * - isPrimitive()
-// * - isTopLevel()
-// * - getSuperclass()
-// */
-// public void test0161() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0161", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("Expression should not be null", result); //$NON-NLS-1$
-// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// List types = compilationUnit.types();
-// assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
-// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
-// ITypeBinding typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("The type binding should not be null", typeBinding); //$NON-NLS-1$
-// assertEquals("The modifier is PUBLIC", Modifier.PUBLIC, typeBinding.getModifiers()); //$NON-NLS-1$
-// assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
-// assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
-// assertNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
-// IFunctionBinding[] methods = typeBinding.getDeclaredMethods();
-// assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$
-// assertEquals("The name is not Test", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$
-// assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$
-// assertTrue("A nested class", !typeBinding.isNested()); //$NON-NLS-1$
-// assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$
-// assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
-// assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
-// assertTrue("An interface", !typeBinding.isInterface()); //$NON-NLS-1$
-// assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
-// assertTrue("Is nested", typeBinding.isTopLevel()); //$NON-NLS-1$
-// assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
-// ITypeBinding superclass = typeBinding.getSuperclass();
-// assertNotNull("No superclass", superclass); //$NON-NLS-1$
-// assertTrue("From source", !superclass.isFromSource()); //$NON-NLS-1$
-// ITypeBinding supersuperclass = superclass.getSuperclass();
-// assertNull("No superclass for java.lang.Object", supersuperclass); //$NON-NLS-1$
-// ITypeBinding[] interfaces = typeBinding.getInterfaces();
-// assertNotNull("No interfaces", interfaces); //$NON-NLS-1$
-// assertEquals("More then one super interface", 1, interfaces.length); //$NON-NLS-1$
-// assertTrue("is not an interface", interfaces[0].isInterface()); //$NON-NLS-1$
-// assertTrue("From source", !interfaces[0].isFromSource()); //$NON-NLS-1$
-// assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
-// }
-//
-// /**
-// * Check ITypeBinding APIs:
-// * - getModifiers()
-// * - getElementType() when it is not an array type
-// * - getDimensions() when it is not an array type
-// * - getDeclaringClass()
-// * - getDeclaringName()
-// * - getName()
-// * - isNested()
-// * - isAnonymous()
-// * - isLocal()
-// * - isMember()
-// * - isArray()
-// * - getDeclaredMethods() => returns binding for default constructor
-// * - isPrimitive()
-// * - isTopLevel()
-// * - getSuperclass()
-// */
-// public void test0162() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0162", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("Expression should not be null", result); //$NON-NLS-1$
-// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// List types = compilationUnit.types();
-// assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
-// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
-// ITypeBinding typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("The type binding should not be null", typeBinding); //$NON-NLS-1$
-// assertEquals("The modifier is PUBLIC", Modifier.PUBLIC, typeBinding.getModifiers()); //$NON-NLS-1$
-// assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
-// assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
-// assertNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
-// IFunctionBinding[] methods = typeBinding.getDeclaredMethods();
-// assertEquals("Contains no methos", 0, methods.length); //$NON-NLS-1$
-// assertEquals("The name is not Test", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$
-// assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$
-// assertTrue("A nested class", !typeBinding.isNested()); //$NON-NLS-1$
-// assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$
-// assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
-// assertTrue("A class", !typeBinding.isClass()); //$NON-NLS-1$
-// assertTrue("Not an interface", typeBinding.isInterface()); //$NON-NLS-1$
-// assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
-// assertTrue("Is nested", typeBinding.isTopLevel()); //$NON-NLS-1$
-// assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
-// ITypeBinding superclass = typeBinding.getSuperclass();
-// assertNull("No superclass", superclass); //$NON-NLS-1$
-// assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
-// }
-//
-// /**
-// * Test binding for anonymous declaration: new java.lang.Object() {}
-// */
-// public void test0163() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0163", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode expression = getASTNodeToCompare((JavaScriptUnit) result);
-// assertNotNull("Expression should not be null", expression); //$NON-NLS-1$
-// assertTrue("Not an anonymous type declaration", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
-// ClassInstanceCreation anonymousClass = (ClassInstanceCreation) expression;
-// ITypeBinding typeBinding = anonymousClass.resolveTypeBinding();
-// assertNotNull("No binding", typeBinding); //$NON-NLS-1$
-// assertTrue("Not an anonymous class", typeBinding.isAnonymous()); //$NON-NLS-1$
-// assertEquals("The modifier is not default", Modifier.NONE, typeBinding.getModifiers()); //$NON-NLS-1$
-// assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
-// assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
-// assertNotNull("This is a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
-// assertEquals("The name is not empty", "", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// IFunctionBinding[] methods = typeBinding.getDeclaredMethods();
-// assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$
-// assertTrue("Not a local class", typeBinding.isLocal()); //$NON-NLS-1$
-// assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$
-// assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$
-// assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
-// assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
-// assertTrue("An interface", !typeBinding.isInterface()); //$NON-NLS-1$
-// assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
-// assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$
-// assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
-// assertEquals("wrong qualified name", "", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
-// ITypeBinding superclass = typeBinding.getSuperclass();
-// assertNotNull("No superclass", superclass); //$NON-NLS-1$
-// assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
-// }
-//
-// /**
-// * Test binding for member type declaration
-// */
-// public void test0164() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0164", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("Not an type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// TypeDeclaration typeDeclaration = (TypeDeclaration) node;
-// ITypeBinding typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("No binding", typeBinding); //$NON-NLS-1$
-// assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$
-// assertEquals("The modifier is not default", Modifier.PRIVATE, typeBinding.getModifiers()); //$NON-NLS-1$
-// assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
-// assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
-// assertNotNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
-// assertEquals("The name is not 'B'", "B", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// IFunctionBinding[] methods = typeBinding.getDeclaredMethods();
-// assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$
-// assertTrue("A local class", !typeBinding.isLocal()); //$NON-NLS-1$
-// assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$
-// assertTrue("Not a member class", typeBinding.isMember()); //$NON-NLS-1$
-// assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
-// assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
-// assertTrue("An interface", !typeBinding.isInterface()); //$NON-NLS-1$
-// assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
-// assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$
-// assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
-// ITypeBinding superclass = typeBinding.getSuperclass();
-// assertNotNull("No superclass", superclass); //$NON-NLS-1$
-// assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
-// }
-//
-// /**
-// * Test binding for local type declaration
-// * @deprecated using deprecated code
-// */
-// public void test0165() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0165", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("Not an type declaration", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
-// TypeDeclarationStatement statement = (TypeDeclarationStatement) node;
-// TypeDeclaration typeDeclaration = statement.getTypeDeclaration();
-// ITypeBinding typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("No binding", typeBinding); //$NON-NLS-1$
-// assertTrue("An anonymous class", !typeBinding.isAnonymous()); //$NON-NLS-1$
-// assertEquals("The modifier is not default", Modifier.NONE, typeBinding.getModifiers()); //$NON-NLS-1$
-// assertNull("There is no element type", typeBinding.getElementType()); //$NON-NLS-1$
-// assertEquals("There is no dimension", 0, typeBinding.getDimensions()); //$NON-NLS-1$
-// assertNotNull("This is not a member type", typeBinding.getDeclaringClass()); //$NON-NLS-1$
-// assertEquals("The name is not 'C'", "C", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// IFunctionBinding[] methods = typeBinding.getDeclaredMethods();
-// assertEquals("Contains the default constructor", 1, methods.length); //$NON-NLS-1$
-// assertTrue("Not a local class", typeBinding.isLocal()); //$NON-NLS-1$
-// assertTrue("Not a nested class", typeBinding.isNested()); //$NON-NLS-1$
-// assertTrue("A member class", !typeBinding.isMember()); //$NON-NLS-1$
-// assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
-// assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
-// assertTrue("An interface", !typeBinding.isInterface()); //$NON-NLS-1$
-// assertTrue("Not from source", typeBinding.isFromSource()); //$NON-NLS-1$
-// assertTrue("Is a top level", !typeBinding.isTopLevel()); //$NON-NLS-1$
-// assertTrue("A primitive type", !typeBinding.isPrimitive()); //$NON-NLS-1$
-// assertEquals("wrong qualified name", "", typeBinding.getQualifiedName()); //$NON-NLS-1$ //$NON-NLS-2$
-// ITypeBinding superclass = typeBinding.getSuperclass();
-// assertNotNull("No superclass", superclass); //$NON-NLS-1$
-// assertEquals("Has fields", 0, typeBinding.getDeclaredFields().length); //$NON-NLS-1$
-// }
-
- /**
- * Multiple local declaration => VariabledeclarationStatement
- */
- public void test0166() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0166", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("Fragment list is not 4 ", fragments.size() == 4); //$NON-NLS-1$
- VariableDeclarationFragment fragment1 = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding binding1 = fragment1.resolveBinding();
- assertNotNull("Binding is null", binding1); //$NON-NLS-1$
- assertEquals("wrong name for binding1", "x", binding1.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong modifier for binding1", 0, binding1.getModifiers()); //$NON-NLS-1$
- assertTrue("a field", !binding1.isField()); //$NON-NLS-1$
-// assertNull("declaring class is not null", binding1.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding typeBinding1 = binding1.getType();
- assertNotNull("typeBinding1 is null", typeBinding1); //$NON-NLS-1$
-// assertTrue("typeBinding1 is not a primitive type", typeBinding1.isPrimitive()); //$NON-NLS-1$
-// assertTrue("typeBinding1 is not canonical", typeBinding1 == binding1.getType()); //$NON-NLS-1$
- VariableDeclarationFragment fragment2 = (VariableDeclarationFragment) fragments.get(1);
- IVariableBinding binding2 = fragment2.resolveBinding();
- assertNotNull("Binding is null", binding2); //$NON-NLS-1$
- assertEquals("wrong name for binding2", "z", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong modifier for binding2", 0, binding2.getModifiers()); //$NON-NLS-1$
- assertTrue("a field", !binding2.isField()); //$NON-NLS-1$
-// assertNull("declaring class is not null", binding2.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding typeBinding2 = binding2.getType();
- assertNotNull("typeBinding2 is null", typeBinding2); //$NON-NLS-1$
-// assertTrue("typeBinding2 is not an array type", typeBinding2.isArray()); //$NON-NLS-1$
-// assertTrue("typeBinding2 is not canonical", typeBinding2 == binding2.getType()); //$NON-NLS-1$
-// assertTrue("primitive type is not canonical", typeBinding1 == typeBinding2.getElementType()); //$NON-NLS-1$
-// assertEquals("dimension is 1", 1, typeBinding2.getDimensions()); //$NON-NLS-1$
-// assertEquals("it is not int[]", "int[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- VariableDeclarationFragment fragment3 = (VariableDeclarationFragment) fragments.get(2);
- IVariableBinding binding3 = fragment3.resolveBinding();
- assertNotNull("Binding is null", binding3); //$NON-NLS-1$
- assertEquals("wrong name for binding3", "i", binding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong modifier for binding3", 0, binding3.getModifiers()); //$NON-NLS-1$
- assertTrue("a field", !binding3.isField()); //$NON-NLS-1$
-// assertNull("declaring class is not null", binding3.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding typeBinding3 = binding3.getType();
- assertNotNull("typeBinding3 is null", typeBinding3); //$NON-NLS-1$
-// assertTrue("typeBinding3 is not an primitive type", typeBinding3.isPrimitive()); //$NON-NLS-1$
-// assertTrue("typeBinding3 is not canonical", typeBinding3 == binding3.getType()); //$NON-NLS-1$
-// assertTrue("primitive type is not canonical", typeBinding1 == typeBinding3); //$NON-NLS-1$
- assertEquals("dimension is 0", 0, typeBinding3.getDimensions()); //$NON-NLS-1$
- assertEquals("it is not the primitive type any", "any", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- VariableDeclarationFragment fragment4 = (VariableDeclarationFragment) fragments.get(3);
- IVariableBinding binding4 = fragment4.resolveBinding();
- assertNotNull("Binding is null", binding4); //$NON-NLS-1$
- assertEquals("wrong name for binding4", "j", binding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong modifier for binding4", 0, binding4.getModifiers()); //$NON-NLS-1$
- assertTrue("a field", !binding4.isField()); //$NON-NLS-1$
- assertNull("declaring class is not null", binding4.getDeclaringClass()); //$NON-NLS-1$
- ITypeBinding typeBinding4 = binding4.getType();
- assertNotNull("typeBinding4 is null", typeBinding4); //$NON-NLS-1$
-// assertTrue("typeBinding4 is not an array type", typeBinding4.isArray()); //$NON-NLS-1$
-// assertTrue("typeBinding4 is not canonical", typeBinding4 == binding4.getType()); //$NON-NLS-1$
-// assertTrue("primitive type is not canonical", typeBinding1 == typeBinding4.getElementType()); //$NON-NLS-1$
-// assertEquals("dimension is 2", 2, typeBinding4.getDimensions()); //$NON-NLS-1$
-// assertEquals("it is not int[][]", "int[][]", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("ids in the wrong order", binding1.getVariableId() < binding2.getVariableId()); //$NON-NLS-1$
- assertTrue("ids in the wrong order", binding2.getVariableId() < binding3.getVariableId()); //$NON-NLS-1$
- assertTrue("ids in the wrong order", binding3.getVariableId() < binding4.getVariableId()); //$NON-NLS-1$
- }
-//
-// /**
-// * Check source position for new Test[1+2].length.
-// */
-// public void test0167() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0167", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("Instance of VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
-// List fragments = variableDeclarationStatement.fragments();
-// assertTrue("fragment list size is not 1", fragments.size() == 1); //$NON-NLS-1$
-// VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
-// Expression initialization = fragment.getInitializer();
-// assertNotNull("No initialization", initialization); //$NON-NLS-1$
-// assertTrue("Not a FieldAccess", initialization instanceof FieldAccess); //$NON-NLS-1$
-// checkSourceRange(initialization, "new Test[1+2].length", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Check package binding: test0168.test
-// */
-// public void test0168() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0168.test1", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("Expression should not be null", result); //$NON-NLS-1$
-// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// List types = compilationUnit.types();
-// assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
-// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
-// ITypeBinding typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
-// IPackageBinding packageBinding = typeBinding.getPackage();
-// assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
-// assertEquals("wrong name", "test0168.test1", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// String[] components = packageBinding.getNameComponents();
-// assertNotNull("no components", components); //$NON-NLS-1$
-// assertTrue("components size != 2", components.length == 2); //$NON-NLS-1$
-// assertEquals("wrong component name", "test0168", components[0]); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("wrong component name", "test1", components[1]); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$
-// assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$
-// assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$
-// }
-
-// /**
-// * Check package binding: test0169
-// */
-// public void test0169() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0169", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("Expression should not be null", result); //$NON-NLS-1$
-// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// List types = compilationUnit.types();
-// assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
-// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
-// ITypeBinding typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
-// IPackageBinding packageBinding = typeBinding.getPackage();
-// assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
-// assertEquals("wrong name", "test0169", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// String[] components = packageBinding.getNameComponents();
-// assertNotNull("no components", components); //$NON-NLS-1$
-// assertTrue("components size != 1", components.length == 1); //$NON-NLS-1$
-// assertEquals("wrong component name", "test0169", components[0]); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$
-// assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$
-// assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$
-// }
-
-// /**
-// * Check package binding: test0170
-// */
-// public void test0170() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test0170.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("Expression should not be null", result); //$NON-NLS-1$
-// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// List types = compilationUnit.types();
-// assertTrue("The types list is empty", types.size() != 0); //$NON-NLS-1$
-// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
-// ITypeBinding typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
-// IPackageBinding packageBinding = typeBinding.getPackage();
-// assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
-// assertEquals("wrong name", "", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// String[] components = packageBinding.getNameComponents();
-// assertNotNull("no components", components); //$NON-NLS-1$
-// assertTrue("components size != 0", components.length == 0); //$NON-NLS-1$
-// assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$
-// assertTrue("Not an unnamed package", packageBinding.isUnnamed()); //$NON-NLS-1$
-// assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$
-// }
-//
-// /**
-// * Check package binding: test0171
-// */
-// public void test0171() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0171", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("Expression should not be null", result); //$NON-NLS-1$
-// assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// List types = compilationUnit.types();
-// assertTrue("The types list is empty", types.size() == 2); //$NON-NLS-1$
-// TypeDeclaration typeDeclaration = (TypeDeclaration) types.get(0);
-// ITypeBinding typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
-// IPackageBinding packageBinding = typeBinding.getPackage();
-// assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
-// assertEquals("wrong name", "test0171", packageBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// String[] components = packageBinding.getNameComponents();
-// assertNotNull("no components", components); //$NON-NLS-1$
-// assertTrue("components size != 1", components.length == 1); //$NON-NLS-1$
-// assertEquals("wrong component name", "test0171", components[0]); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("wrong type", IBinding.PACKAGE, packageBinding.getKind()); //$NON-NLS-1$
-// assertTrue("Unnamed package", !packageBinding.isUnnamed()); //$NON-NLS-1$
-// assertTrue("Package binding is not canonical", packageBinding == typeBinding.getPackage()); //$NON-NLS-1$
-//
-// typeDeclaration = (TypeDeclaration) types.get(1);
-// typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
-// IPackageBinding packageBinding2 = typeBinding.getPackage();
-// assertNotNull("No package binding", packageBinding); //$NON-NLS-1$
-// assertTrue("Package binding is not canonical", packageBinding == packageBinding2); //$NON-NLS-1$
-// }
-
- /**
- * Check method binding
- */
- public void test0172() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0172", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("Expression should not be null", result); //$NON-NLS-1$
- assertTrue("The result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- List statements = compilationUnit.statements();
- assertTrue("The statements list is empty", statements.size() != 0); //$NON-NLS-1$
-// TypeDeclaration typeDeclaration = (TypeDeclaration) statements.get(0);
-// ITypeBinding typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("Binding not null", typeBinding); //$NON-NLS-1$
-// IFunctionBinding[] methods = null;// typeBinding.getDeclaredMethods();
-// assertNotNull("No methods", methods);
-// assertEquals("methods.length != 4", 4, methods.length); //$NON-NLS-1$
-// List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("statements size != 3", 3, statements.size()); //$NON-NLS-1$
- FunctionDeclaration method1 = (FunctionDeclaration) statements.get(0);
- IFunctionBinding methodBinding1 = method1.resolveBinding();
- assertNotNull("No method binding for foo", methodBinding1); //$NON-NLS-1$
- SimpleName simpleName = method1.getName();
- assertTrue("not a declaration", simpleName.isDeclaration()); //$NON-NLS-1$
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong name", binding.getName(), simpleName.getIdentifier()); //$NON-NLS-1$
- // search method foo
-// IFunctionBinding methodBinding = null;
-// loop: for (int i = 0, max = methods.length; i < max; i++) {
-// IFunctionBinding currentMethod = methods[i];
-// if ("foo".equals(currentMethod.getName())) {
-// methodBinding = currentMethod;
-// break loop;
-// }
-// }
-// assertNotNull("Cannot be null", methodBinding);
-// assertTrue("Canonical method binding", methodBinding1 == methodBinding); //$NON-NLS-1$
-// assertTrue("declaring class is canonical", typeBinding == methodBinding1.getDeclaringClass()); //$NON-NLS-1$
-// ITypeBinding[] exceptionTypes = methodBinding1.getExceptionTypes();
-// assertNotNull("No exception types", exceptionTypes); //$NON-NLS-1$
-// assertEquals("One exception", 1, exceptionTypes.length); //$NON-NLS-1$
-// assertEquals("wrong name for exception", "IOException", exceptionTypes[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong modifier", Modifier.PUBLIC, methodBinding1.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name for method", "foo", methodBinding1.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding[] parameters = methodBinding1.getParameterTypes();
- assertNotNull("No parameters", parameters); //$NON-NLS-1$
- assertEquals("wrong size", 1, parameters.length); //$NON-NLS-1$
-// assertEquals("wrong type", "int[]", parameters[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong return type", "void", methodBinding1.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertTrue("A constructor", !methodBinding1.isConstructor()); //$NON-NLS-1$
-
- FunctionDeclaration method2 = (FunctionDeclaration) statements.get(1);
- IFunctionBinding methodBinding2 = method2.resolveBinding();
- assertNotNull("No method binding for main", methodBinding2); //$NON-NLS-1$
-// methodBinding = null;
-// loop: for (int i = 0, max = methods.length; i < max; i++) {
-// IFunctionBinding currentMethod = methods[i];
-// if ("main".equals(currentMethod.getName())) {
-// methodBinding = currentMethod;
-// break loop;
-// }
-// }
-// assertNotNull("Cannot be null", methodBinding);
-// assertTrue("Canonical method binding", methodBinding2 == methodBinding); //$NON-NLS-1$
-// assertTrue("declaring class is canonical", typeBinding == methodBinding2.getDeclaringClass()); //$NON-NLS-1$
-// ITypeBinding[] exceptionTypes2 = methodBinding2.getExceptionTypes();
-// assertNotNull("No exception types", exceptionTypes2); //$NON-NLS-1$
-// assertEquals("No exception", 0, exceptionTypes2.length); //$NON-NLS-1$
-// assertEquals("wrong modifier", Modifier.PUBLIC | Modifier.STATIC, methodBinding2.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name for method", "main", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding[] parameters2 = methodBinding2.getParameterTypes();
- assertNotNull("No parameters", parameters2); //$NON-NLS-1$
- assertEquals("wrong size", 1, parameters2.length); //$NON-NLS-1$
-// assertEquals("wrong type for parameter2[0]", "String[]", parameters2[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong return type", "void", methodBinding2.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertTrue("A constructor", !methodBinding2.isConstructor()); //$NON-NLS-1$
-
- FunctionDeclaration method3 = (FunctionDeclaration) statements.get(2);
- IFunctionBinding methodBinding3 = method3.resolveBinding();
- assertNotNull("No method binding for main", methodBinding3); //$NON-NLS-1$
-// methodBinding = null;
-// loop: for (int i = 0, max = methods.length; i < max; i++) {
-// IFunctionBinding currentMethod = methods[i];
-// if ("bar".equals(currentMethod.getName())) {
-// methodBinding = currentMethod;
-// break loop;
-// }
-// }
-// assertNotNull("Cannot be null", methodBinding);
-// assertTrue("Canonical method binding", methodBinding3 == methodBinding); //$NON-NLS-1$
-// assertTrue("declaring class is canonical", typeBinding == methodBinding3.getDeclaringClass()); //$NON-NLS-1$
-// ITypeBinding[] exceptionTypes3 = methodBinding3.getExceptionTypes();
-// assertNotNull("No exception types", exceptionTypes3); //$NON-NLS-1$
-// assertEquals("No exception", 1, exceptionTypes3.length); //$NON-NLS-1$
-// assertEquals("wrong modifier", Modifier.PRIVATE, methodBinding3.getModifiers()); //$NON-NLS-1$
- assertEquals("wrong name for method", "bar", methodBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding[] parameters3 = methodBinding3.getParameterTypes();
- assertNotNull("No parameters", parameters3); //$NON-NLS-1$
- assertEquals("wrong size", 1, parameters3.length); //$NON-NLS-1$
- assertEquals("wrong type", "any", parameters3[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong return type", "any", methodBinding3.getReturnType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertTrue("A constructor", !methodBinding3.isConstructor()); //$NON-NLS-1$
- assertTrue("The binding is not canonical", parameters3[0] == methodBinding3.getReturnType()); //$NON-NLS-1$
- }
-
- /**
- * i++; IVariableBinding
- */
- public void test0173() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0173", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression ex = expressionStatement.getExpression();
- assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$
- PostfixExpression postfixExpression = (PostfixExpression) ex;
- Expression expr = postfixExpression.getOperand();
- assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$
- SimpleName name = (SimpleName) expr;
- assertTrue("a declaration", !name.isDeclaration()); //$NON-NLS-1$
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
-
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertTrue(variableBinding == binding);
- }
-
- /**
- * i++; IVariableBinding (field)
- */
- public void test0174() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0174", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 1, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression ex = expressionStatement.getExpression();
- assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$
- PostfixExpression postfixExpression = (PostfixExpression) ex;
- Expression expr = postfixExpression.getOperand();
- assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$
- SimpleName name = (SimpleName) expr;
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
-
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node2;
- List fragments = fieldDeclaration.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertTrue(variableBinding == binding);
- }
-
- /**
- * int i = 0; Test IntBinding for the field declaration and the 0 literal
- */
- public void test0175() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0175", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node2;
- List fragments = fieldDeclaration.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- ITypeBinding typeBinding = fragment.getInitializer().resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not Number", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * i++; IVariableBinding
- */
- public void test0177() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0177", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 1, 1);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("Not an expressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression ex = expressionStatement.getExpression();
- assertTrue("Not a postfixexpression", ex instanceof PostfixExpression); //$NON-NLS-1$
- PostfixExpression postfixExpression = (PostfixExpression) ex;
- Expression expr = postfixExpression.getOperand();
- assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$
- SimpleName name = (SimpleName) expr;
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
-
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertEquals("return type is not Number", "Number", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue(variableBinding == binding);
- }
-//
-// /**
-// * SuperReference
-// */
-// public void test0178() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0178", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 1, 0, 0);
-// assertTrue("Return statement", node2 instanceof ReturnStatement); //$NON-NLS-1$
-// ReturnStatement returnStatement = (ReturnStatement) node2;
-// Expression expr = returnStatement.getExpression();
-// assertTrue("Not a field access", expr instanceof SuperFieldAccess); //$NON-NLS-1$
-// SuperFieldAccess fieldAccess = (SuperFieldAccess) expr;
-// ITypeBinding typeBinding = fieldAccess.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$
-// assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-
- /**
- * Allocation expression
- */
- public void test0179() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0179", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- Expression initialization = fragment.getInitializer();
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue(variableBinding.getType() == typeBinding);
- }
-
-// /**
-// * Allocation expression
-// */
-// public void test0180() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0180", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
-// List fragments = variableDeclarationStatement.fragments();
-// assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
-// VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
-// IVariableBinding variableBinding = fragment.resolveBinding();
-// Expression initialization = fragment.getInitializer();
-// assertTrue("No an array creation", initialization instanceof ArrayCreation); //$NON-NLS-1$
-// ITypeBinding typeBinding = initialization.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$
-// assertTrue(variableBinding.getType() == typeBinding);
-// }
-//
-// /**
-// * Allocation expression
-// */
-// public void test0181() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0181", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
-// List fragments = variableDeclarationStatement.fragments();
-// assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
-// VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
-// IVariableBinding variableBinding = fragment.resolveBinding();
-// Expression initialization = fragment.getInitializer();
-// ITypeBinding typeBinding = initialization.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$
-// assertTrue(variableBinding.getType() == typeBinding);
-// }
-
- /**
- * BinaryExpression
- */
- public void test0182() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0182", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i < 10", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0183() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0183", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i < 10 && i < 20", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0184() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0184", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i < 10 || i < 20", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0185() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0185", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i == 10", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0186() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0186", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node2;
- Expression expr = ifStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "o == o", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0187() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0187", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("IfStatement", node2 instanceof WhileStatement); //$NON-NLS-1$
- WhileStatement whileStatement = (WhileStatement) node2;
- Expression expr = whileStatement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i <= 10", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0188() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0188", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 2);
- assertTrue("DoStatement", node2 instanceof DoStatement); //$NON-NLS-1$
- DoStatement statement = (DoStatement) node2;
- Expression expr = statement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i <= 10", source); //$NON-NLS-1$
- }
-
- /**
- * BinaryExpression
- */
- public void test0189() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0189", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("ForStatement", node2 instanceof ForStatement); //$NON-NLS-1$
- ForStatement statement = (ForStatement) node2;
- Expression expr = statement.getExpression();
- assertNotNull("No condition", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "i < 10", source); //$NON-NLS-1$
- }
-//
-// /**
-// * BinaryExpression
-// */
-// public void test0190() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0190", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 2, 1);
-// assertTrue("IfStatement", node2 instanceof IfStatement); //$NON-NLS-1$
-// IfStatement statement = (IfStatement) node2;
-// Expression expr = statement.getExpression();
-// assertNotNull("No condition", expr); //$NON-NLS-1$
-// ITypeBinding typeBinding = expr.resolveTypeBinding();
-// assertNotNull("No binding", typeBinding); //$NON-NLS-1$
-// assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// checkSourceRange(expr, "scanner.x < selection.start && selection.start < scanner.y", source); //$NON-NLS-1$
-// }
-
- /**
- * BinaryExpression
- */
- public void test0191() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0191", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression ex = expressionStatement.getExpression();
- assertTrue("Assignment", ex instanceof Assignment); //$NON-NLS-1$
- Assignment statement = (Assignment) ex;
- Expression rightExpr = statement.getRightHandSide();
- assertTrue("Not an infix expression", rightExpr instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) rightExpr;
- Expression expr = infixExpression.getRightOperand();
- assertNotNull("No right hand side expression", expr); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not a boolean", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(expr, "2 < 20", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0192() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0192", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- Expression initialization = fragment.getInitializer();
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertTrue(variableBinding.getType() == typeBinding);
- checkSourceRange(initialization, "0", source); //$NON-NLS-1$
- }
-
-// /**
-// * Initializer
-// */
-// public void test0193() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0193", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0);
-// assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
-// List fragments = variableDeclarationStatement.fragments();
-// assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
-// VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
-// IVariableBinding variableBinding = fragment.resolveBinding();
-// Expression initialization = fragment.getInitializer();
-// ITypeBinding typeBinding = initialization.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// assertTrue(variableBinding.getType() == typeBinding);
-// checkSourceRange(initialization, "new Inner()", source); //$NON-NLS-1$
-// assertEquals("Wrong type", "Inner", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-//
-// /**
-// * Initializer
-// */
-// public void test0194() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0194", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0);
-// assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
-// List fragments = variableDeclarationStatement.fragments();
-// assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
-// VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
-// IVariableBinding variableBinding = fragment.resolveBinding();
-// Expression initialization = fragment.getInitializer();
-// ITypeBinding typeBinding = initialization.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// assertTrue(variableBinding.getType() == typeBinding);
-// checkSourceRange(initialization, "new Inner[10]", source); //$NON-NLS-1$
-// assertTrue("Not an array", typeBinding.isArray()); //$NON-NLS-1$
-// assertEquals("Wrong type", "Inner[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-
-// /**
-// * Initializer
-// */
-// public void test0195() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0195", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 1, 0, 1);
-// assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
-// ExpressionStatement expressionStatement = (ExpressionStatement) node2;
-// Expression ex = expressionStatement.getExpression();
-// assertTrue("FunctionInvocation", ex instanceof FunctionInvocation); //$NON-NLS-1$
-// FunctionInvocation methodInvocation = (FunctionInvocation) ex;
-// checkSourceRange(methodInvocation, "a.useFile(/*]*/a.getFile()/*[*/)", source); //$NON-NLS-1$
-// List list = methodInvocation.arguments();
-// assertTrue("Parameter list not empty", list.size() == 1); //$NON-NLS-1$
-// Expression parameter = (Expression) list.get(0);
-// assertTrue("Not a method invocation", parameter instanceof FunctionInvocation); //$NON-NLS-1$
-// ITypeBinding typeBinding = parameter.resolveTypeBinding();
-// assertNotNull("No binding", typeBinding); //$NON-NLS-1$
-// assertEquals("Not a boolean", "File", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// checkSourceRange(parameter, "a.getFile()", source); //$NON-NLS-1$
-// }
-
-// /**
-// * Initializer
-// */
-// public void test0196() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0196", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 2);
-// assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
-// ExpressionStatement expressionStatement = (ExpressionStatement) node2;
-// Expression ex = expressionStatement.getExpression();
-// assertTrue("Assignment", ex instanceof Assignment); //$NON-NLS-1$
-// Assignment statement = (Assignment) ex;
-// Expression rightExpr = statement.getRightHandSide();
-// assertTrue("Not an instanceof expression", rightExpr instanceof InstanceofExpression); //$NON-NLS-1$
-// ITypeBinding typeBinding = rightExpr.resolveTypeBinding();
-// assertNotNull("No binding", typeBinding); //$NON-NLS-1$
-// assertEquals("wrong type", "boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// checkSourceRange(rightExpr, "inner instanceof Inner", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Initializer
-// */
-// public void test0197() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0197", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType());
-// JavaScriptUnit unit = (JavaScriptUnit) result;
-// assertProblemsSize(unit, 0);
-// ASTNode node2 = getASTNode(unit, 1, 0, 1);
-// assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
-// ExpressionStatement expressionStatement = (ExpressionStatement) node2;
-// Expression ex = expressionStatement.getExpression();
-// assertTrue("FunctionInvocation", ex instanceof FunctionInvocation); //$NON-NLS-1$
-// FunctionInvocation methodInvocation = (FunctionInvocation) ex;
-// checkSourceRange(methodInvocation, "a.getFile()/*[*/.getName()", source); //$NON-NLS-1$
-// Expression receiver = methodInvocation.getExpression();
-// assertTrue("Not a method invocation", receiver instanceof FunctionInvocation); //$NON-NLS-1$
-// FunctionInvocation methodInvocation2 = (FunctionInvocation) receiver;
-// ITypeBinding typeBinding = methodInvocation2.resolveTypeBinding();
-// assertNotNull("No binding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "File", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// checkSourceRange(methodInvocation2, "a.getFile()", source); //$NON-NLS-1$
-// }
-
- /**
- * Initializer
- */
- public void test0198() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0198", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node2;
- Expression expr = returnStatement.getExpression();
- assertTrue("Not an infixExpression", expr instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expr;
- Expression left = infixExpression.getLeftOperand();
- assertTrue("Not an InfixExpression", left instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression2 = (InfixExpression) left;
- Expression right = infixExpression2.getRightOperand();
- assertTrue("Not an InfixExpression", right instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression3 = (InfixExpression) right;
- assertEquals("A multiplication", InfixExpression.Operator.TIMES, infixExpression3.getOperator()); //$NON-NLS-1$
- ITypeBinding typeBinding = infixExpression3.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not Number", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(infixExpression3, "20 * 30", source); //$NON-NLS-1$
- }
-
- /**
- * Initializer
- */
- public void test0199() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0199", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
- List fragments = variableDeclarationStatement.fragments();
- assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertTrue("Not an infixExpression", initialization instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) initialization;
- Expression left = infixExpression.getLeftOperand();
- assertTrue("Not an InfixExpression", left instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression2 = (InfixExpression) left;
- Expression right = infixExpression2.getRightOperand();
- assertTrue("Not an InfixExpression", right instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression3 = (InfixExpression) right;
- assertEquals("A multiplication", InfixExpression.Operator.TIMES, infixExpression3.getOperator()); //$NON-NLS-1$
- ITypeBinding typeBinding = infixExpression3.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Not Number", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- checkSourceRange(infixExpression3, "10 * 30", source); //$NON-NLS-1$
- }
-//
-// /**
-// * Initializer
-// */
-// public void test0200() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0200", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 1, 0, 0);
-// assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
-// List fragments = variableDeclarationStatement.fragments();
-// assertTrue("No fragment", fragments.size() == 1); //$NON-NLS-1$
-// VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
-// Expression initialization = fragment.getInitializer();
-// assertTrue("Not an infixExpression", initialization instanceof FieldAccess); //$NON-NLS-1$
-// FieldAccess fieldAccess = (FieldAccess) initialization;
-// Expression receiver = fieldAccess.getExpression();
-// assertTrue("ArrayCreation", receiver instanceof ArrayCreation); //$NON-NLS-1$
-// ArrayCreation arrayCreation = (ArrayCreation) receiver;
-// List dimensions = arrayCreation.dimensions();
-// assertEquals("Wrong dimension", 1, dimensions.size()); //$NON-NLS-1$
-// Expression dim = (Expression) dimensions.get(0);
-// assertTrue("InfixExpression", dim instanceof InfixExpression); //$NON-NLS-1$
-// InfixExpression infixExpression = (InfixExpression) dim;
-// ITypeBinding typeBinding = infixExpression.resolveTypeBinding();
-// assertNotNull("No binding", typeBinding); //$NON-NLS-1$
-// assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// checkSourceRange(infixExpression, "1 + 2", source); //$NON-NLS-1$
-// }
-
- /**
- * Position inside for statement: PR 3300
- */
- public void test0201() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0201", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("ForStatement", node2 instanceof ForStatement); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node2;
- List initializers = forStatement.initializers();
- assertTrue("wrong size", initializers.size() == 1); //$NON-NLS-1$
- Expression init = (Expression) initializers.get(0);
- checkSourceRange(init, "var i= 0", source); //$NON-NLS-1$
- }
-
- /**
- * PR 7386
- */
- public void test0202() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0202", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node2;
- checkSourceRange(fieldDeclaration, "var f= (2);", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$
- checkSourceRange(initialization, "(2)", source); //$NON-NLS-1$
- ITypeBinding typeBinding = initialization.resolveTypeBinding();
- assertNotNull("no binding", typeBinding); //$NON-NLS-1$
- assertEquals("not Number", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * PR 7386
- */
- public void test0203() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0203", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node2;
- checkSourceRange(fieldDeclaration, "var f= (2);", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) initialization;
- checkSourceRange(parenthesizedExpression, "(2)", source); //$NON-NLS-1$
- Expression expr = parenthesizedExpression.getExpression();
- checkSourceRange(expr, "2", source); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("no binding", typeBinding); //$NON-NLS-1$
- assertEquals("not Number", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertTrue("type binding is canonical", typeBinding == parenthesizedExpression.resolveTypeBinding()); //$NON-NLS-1$
- }
-
- /**
- * PR 7386
- */
- public void test0204() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0204", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node2;
- checkSourceRange(fieldDeclaration, "var f= ((2));", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initialization = fragment.getInitializer();
- assertTrue("Not a parenthesized expression", initialization instanceof ParenthesizedExpression); //$NON-NLS-1$
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) initialization;
- checkSourceRange(parenthesizedExpression, "((2))", source); //$NON-NLS-1$
- Expression expr = parenthesizedExpression.getExpression();
- assertTrue("Not a parenthesized expression", expr instanceof ParenthesizedExpression); //$NON-NLS-1$
- ParenthesizedExpression parenthesizedExpression2 = (ParenthesizedExpression) expr;
- checkSourceRange(parenthesizedExpression2, "(2)", source); //$NON-NLS-1$
- expr = parenthesizedExpression2.getExpression();
- checkSourceRange(expr, "2", source); //$NON-NLS-1$
- ITypeBinding typeBinding = expr.resolveTypeBinding();
- assertNotNull("no binding", typeBinding); //$NON-NLS-1$
- assertEquals("not Number", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = parenthesizedExpression.resolveTypeBinding();
- assertNotNull("no binding", typeBinding); //$NON-NLS-1$
- assertEquals("not Number", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertTrue("type binding is canonical", typeBinding == parenthesizedExpression2.resolveTypeBinding()); //$NON-NLS-1$
- }
-
-
-// /**
-// * Local class end position when trailing comment
-// * @deprecated using deprecated code
-// */
-// public void test0205() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0205", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertTrue("TypeDeclarationStatement", node2 instanceof TypeDeclarationStatement); //$NON-NLS-1$
-// TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node2;
-// TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration();
-// assertEquals("wrong name", "AA", typeDeclaration.getName().getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
-// checkSourceRange(typeDeclaration, "class AA extends Test {}", source); //$NON-NLS-1$
-// }
-
-// /**
-// * QualifiedName
-// */
-// public void test0206() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0206", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 5, 0);
-// assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$
-// ReturnStatement returnStatement = (ReturnStatement) node2;
-// Expression expr = returnStatement.getExpression();
-// assertTrue("Not a qualifiedName", expr instanceof QualifiedName); //$NON-NLS-1$
-// QualifiedName qualifiedName = (QualifiedName) expr;
-// ITypeBinding typeBinding = expr.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// assertEquals("Not an int (typeBinding)", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// checkSourceRange(qualifiedName, "field1.field2.field3.field4.i", source); //$NON-NLS-1$
-// assertTrue("Not a simple name", qualifiedName.getName().isSimpleName()); //$NON-NLS-1$
-// SimpleName simpleName = qualifiedName.getName();
-// assertTrue("a declaration", !simpleName.isDeclaration()); //$NON-NLS-1$
-// checkSourceRange(simpleName, "i", source); //$NON-NLS-1$
-// ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
-// assertNotNull("No typebinding2", typeBinding2); //$NON-NLS-1$
-// assertEquals("Not an int (typeBinding2)", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// IBinding binding = simpleName.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
-// IVariableBinding variableBinding = (IVariableBinding) binding;
-// assertEquals("Not Test", "Test", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("Not default", Modifier.PUBLIC, variableBinding.getModifiers()); //$NON-NLS-1$
-// Name qualifierName = qualifiedName.getQualifier();
-// assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
-// checkSourceRange(qualifierName, "field1.field2.field3.field4", source); //$NON-NLS-1$
-// ITypeBinding typeBinding5 = qualifierName.resolveTypeBinding();
-// assertNotNull("No binding5", typeBinding5); //$NON-NLS-1$
-// assertEquals("Not Test", "Test", typeBinding5.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-//
-// qualifiedName = (QualifiedName) qualifierName;
-// simpleName = qualifiedName.getName();
-// checkSourceRange(simpleName, "field4", source); //$NON-NLS-1$
-// ITypeBinding typeBinding6 = simpleName.resolveTypeBinding();
-// assertNotNull("No binding6", typeBinding6); //$NON-NLS-1$
-// assertEquals("Not Test", "Test", typeBinding6.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-//
-// qualifierName = qualifiedName.getQualifier();
-// assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
-// checkSourceRange(qualifierName, "field1.field2.field3", source); //$NON-NLS-1$
-// ITypeBinding typeBinding7 = qualifierName.resolveTypeBinding();
-// assertNotNull("No binding7", typeBinding7); //$NON-NLS-1$
-// assertEquals("Not Test", "Test", typeBinding7.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-//
-// qualifiedName = (QualifiedName) qualifierName;
-// simpleName = qualifiedName.getName();
-// checkSourceRange(simpleName, "field3", source); //$NON-NLS-1$
-// qualifierName = qualifiedName.getQualifier();
-// assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
-// checkSourceRange(qualifierName, "field1.field2", source); //$NON-NLS-1$
-// ITypeBinding typeBinding3 = qualifierName.resolveTypeBinding();
-// assertNotNull("No binding3", typeBinding3); //$NON-NLS-1$
-// assertEquals("Not Test", "Test", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// qualifiedName = (QualifiedName) qualifierName;
-// simpleName = qualifiedName.getName();
-// checkSourceRange(simpleName, "field2", source); //$NON-NLS-1$
-// qualifierName = qualifiedName.getQualifier();
-// assertTrue("Not a simple name", qualifierName.isSimpleName()); //$NON-NLS-1$
-// assertTrue("a declaration", !((SimpleName)qualifierName).isDeclaration()); //$NON-NLS-1$
-// checkSourceRange(qualifierName, "field1", source); //$NON-NLS-1$
-// ITypeBinding typeBinding4 = qualifierName.resolveTypeBinding();
-// assertNotNull("No binding4", typeBinding4); //$NON-NLS-1$
-// assertEquals("Not Test", "Test", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-//
- /**
- * Check javadoc for FunctionDeclaration
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0207() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0207", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc();
- JSdoc javadoc = this.ast.newJSdoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- checkSourceRange(node, "/** JavaDoc Comment*/\n function foo( i) {}", source); //$NON-NLS-1$
- checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FunctionDeclaration
- */
- public void test0208() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0208", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "function foo( i) {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for FunctionDeclaration
- */
- public void test0209() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0209", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- JSdoc actualJavadoc = ((FunctionDeclaration) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "function foo( i) {}", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for VariableDeclarationStatement
- * @deprecated marking deprecated since using deprecated code
- */
- public void test0210() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0210", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- JSdoc actualJavadoc = ((VariableDeclarationStatement) node).getJavadoc();
- JSdoc javadoc = this.ast.newJSdoc();
- javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
- assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
- checkSourceRange(node, "/** JavaDoc Comment*/\n var i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for VariableDeclarationStatement
- */
- public void test0211() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0211", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- JSdoc actualJavadoc = ((VariableDeclarationStatement) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "var i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for VariableDeclarationStatement
- */
- public void test0212() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0212", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- JSdoc actualJavadoc = ((VariableDeclarationStatement) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- checkSourceRange(node, "var i;", source); //$NON-NLS-1$
- }
-
- /**
- * Check javadoc for TypeDeclaration
- */
- public void test0213() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0213", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0,0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- assertTrue("The node is not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- JSdoc actualJavadoc = ((VariableDeclarationStatement) node).getJavadoc();
- assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
- String expectedContents = "" +//$NON-NLS-1$
- "var i;" +//$NON-NLS-1$
- "";//$NON-NLS-1$
- checkSourceRange(node, expectedContents, source); //$NON-NLS-1$ }
- }
-
-// /**
-// * Check javadoc for TypeDeclaration
-// */
-// public void test0214() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0214", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
-// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
-// String expectedContents = "public class Test {\n" +//$NON-NLS-1$
-// " int i;\n" +//$NON-NLS-1$
-// "}";//$NON-NLS-1$
-// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Check javadoc for TypeDeclaration
-// * @deprecated marking deprecated since using deprecated code
-// */
-// public void test0215() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0215", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
-// Javadoc javadoc = this.ast.newJavadoc();
-// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
-// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
-// String expectedContents =
-// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
-// "public class Test {\n" +//$NON-NLS-1$
-// " int i;\n" +//$NON-NLS-1$
-// "}";//$NON-NLS-1$
-// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
-// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-// }
-
-// /**
-// * Check javadoc for MemberTypeDeclaration
-// * @deprecated marking deprecated since using deprecated code
-// */
-// public void test0216() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0216", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
-// Javadoc javadoc = this.ast.newJavadoc();
-// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
-// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
-// String expectedContents =
-// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
-// " class B {}";//$NON-NLS-1$
-// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
-// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Check javadoc for MemberTypeDeclaration
-// */
-// public void test0217() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0217", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
-// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
-// checkSourceRange(node, "class B {}", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Check javadoc for MemberTypeDeclaration
-// */
-// public void test0218() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0218", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
-// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
-// checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$
-// }
-
-// /**
-// * Check javadoc for MemberTypeDeclaration
-// */
-// public void test0219() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0219", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// assertTrue("The node is not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((TypeDeclaration) node).getJavadoc();
-// assertTrue("Javadoc must be null", actualJavadoc == null);//$NON-NLS-1$
-// checkSourceRange(node, "public static class B {}", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * Checking initializers
-// */
-// public void test0220() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0220", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// checkSourceRange(node, "{}", source); //$NON-NLS-1$
-// }
-
-// /**
-// * Checking initializers
-// */
-// public void test0221() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0221", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// checkSourceRange(node, "static {}", source); //$NON-NLS-1$
-// }
-
-// /**
-// * Checking initializers
-// * @deprecated marking deprecated since using deprecated code
-// */
-// public void test0222() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0222", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((Initializer) node).getJavadoc();
-// assertNotNull("Javadoc comment should no be null", actualJavadoc); //$NON-NLS-1$
-// Javadoc javadoc = this.ast.newJavadoc();
-// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
-// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
-// String expectedContents =
-// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
-// " static {}";//$NON-NLS-1$
-// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
-// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-//
-// }
-
-// /**
-// * Checking initializers
-// * @deprecated marking deprecated since using deprecated code
-// */
-// public void test0223() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0223", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((Initializer) node).getJavadoc();
-// assertNotNull("Javadoc comment should not be null", actualJavadoc); //$NON-NLS-1$
-// Javadoc javadoc = this.ast.newJavadoc();
-// javadoc.setComment("/** JavaDoc Comment*/");//$NON-NLS-1$*/
-// assertTrue("Both AST trees should be identical", javadoc.subtreeMatch(new ASTMatcher(), actualJavadoc));//$NON-NLS-1$
-// String expectedContents =
-// "/** JavaDoc Comment*/\n" + //$NON-NLS-1$
-// " {}";//$NON-NLS-1$
-// checkSourceRange(node, expectedContents, source); //$NON-NLS-1$
-// checkSourceRange(actualJavadoc, "/** JavaDoc Comment*/", source); //$NON-NLS-1$
-//
-// }
-
-// /**
-// * Checking initializers
-// */
-// public void test0224() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0224", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertNotNull("Expression should not be null", node); //$NON-NLS-1$
-// Javadoc actualJavadoc = ((Initializer) node).getJavadoc();
-// assertNull("Javadoc comment should be null", actualJavadoc); //$NON-NLS-1$
-// checkSourceRange(node, "{}", source); //$NON-NLS-1$
-// }
-
- /**
- * Continue ==> ContinueStatement
- */
- public void test0225() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0225", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0);
- checkSourceRange(labeledStatement.getLabel(), "label", source); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) labeledStatement.getBody();
- ContinueStatement statement = (ContinueStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- ContinueStatement continueStatement = this.ast.newContinueStatement();
- continueStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", continueStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "continue label;", source); //$NON-NLS-1$
- checkSourceRange(statement.getLabel(), "label", source); //$NON-NLS-1$
- }
-
- /**
- * Break + label ==> BreakStatement
- */
- public void test0226() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0226", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- LabeledStatement labeledStatement = (LabeledStatement) getASTNode((JavaScriptUnit) result, 0, 0, 0);
- checkSourceRange(labeledStatement.getLabel(), "label", source); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) labeledStatement.getBody();
- BreakStatement statement = (BreakStatement) ((Block) forStatement.getBody()).statements().get(0);
- assertNotNull("Expression should not be null", statement); //$NON-NLS-1$
- BreakStatement breakStatement = this.ast.newBreakStatement();
- breakStatement.setLabel(this.ast.newSimpleName("label")); //$NON-NLS-1$
- assertTrue("Both AST trees should be identical", breakStatement.subtreeMatch(new ASTMatcher(), statement)); //$NON-NLS-1$
- checkSourceRange(statement, "break label;", source); //$NON-NLS-1$
- checkSourceRange(statement.getLabel(), "label", source); //$NON-NLS-1$
- }
-
-// /**
-// * QualifiedName
-// */
-// public void test0227() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0227", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 3, 2, 0);
-// assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$
-// ReturnStatement returnStatement = (ReturnStatement) node2;
-// Expression expr = returnStatement.getExpression();
-// assertTrue("Not a qualifiedName", expr instanceof QualifiedName); //$NON-NLS-1$
-// QualifiedName qualifiedName = (QualifiedName) expr;
-// ITypeBinding typeBinding = expr.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// assertEquals("Not an long (typeBinding)", "long", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// checkSourceRange(qualifiedName, "field.fB.fA.j", source); //$NON-NLS-1$
-//
-// SimpleName simpleName = qualifiedName.getName();
-// checkSourceRange(simpleName, "j", source); //$NON-NLS-1$
-// ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
-// assertEquals("Not an long (typeBinding2)", "long", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// IBinding binding = simpleName.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
-// IVariableBinding variableBinding = (IVariableBinding) binding;
-// assertEquals("Not A", "A", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("Not default", Modifier.NONE, variableBinding.getModifiers()); //$NON-NLS-1$
-// assertEquals("wrong name", "j", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-//
-// Name qualifierName = qualifiedName.getQualifier();
-// assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
-// checkSourceRange(qualifierName, "field.fB.fA", source); //$NON-NLS-1$
-// qualifiedName = (QualifiedName) qualifierName;
-// ITypeBinding typeBinding3 = qualifiedName.resolveTypeBinding();
-// assertNotNull("No type binding3", typeBinding3); //$NON-NLS-1$
-// assertEquals("Not an A", "A", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// simpleName = qualifiedName.getName();
-// checkSourceRange(simpleName, "fA", source); //$NON-NLS-1$
-// ITypeBinding typeBinding4 = simpleName.resolveTypeBinding();
-// assertNotNull("No typeBinding4", typeBinding4); //$NON-NLS-1$
-// assertEquals("Not an A", "A", typeBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// IBinding binding2 = qualifiedName.resolveBinding();
-// assertNotNull("No binding2", binding2); //$NON-NLS-1$
-// assertTrue("VariableBinding", binding2 instanceof IVariableBinding); //$NON-NLS-1$
-// IVariableBinding variableBinding2 = (IVariableBinding) binding2;
-// assertEquals("Not B", "B", variableBinding2.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("Not default", Modifier.NONE, variableBinding2.getModifiers()); //$NON-NLS-1$
-// assertEquals("wrong name", "fA", variableBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-//
-// qualifierName = qualifiedName.getQualifier();
-// assertTrue("Not a qualified name", qualifierName.isQualifiedName()); //$NON-NLS-1$
-// checkSourceRange(qualifierName, "field.fB", source); //$NON-NLS-1$
-// qualifiedName = (QualifiedName) qualifierName;
-// ITypeBinding typeBinding5 = qualifiedName.resolveTypeBinding();
-// assertNotNull("No typeBinding5", typeBinding5); //$NON-NLS-1$
-// assertEquals("Not a B", "B", typeBinding5.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// simpleName = qualifiedName.getName();
-// checkSourceRange(simpleName, "fB", source); //$NON-NLS-1$
-// ITypeBinding typeBinding6 = simpleName.resolveTypeBinding();
-// assertNotNull("No typebinding6", typeBinding6); //$NON-NLS-1$
-// assertEquals("not a B", "B", typeBinding6.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// IBinding binding3 = qualifiedName.resolveBinding();
-// assertNotNull("No binding2", binding3); //$NON-NLS-1$
-// assertTrue("VariableBinding", binding3 instanceof IVariableBinding); //$NON-NLS-1$
-// IVariableBinding variableBinding3 = (IVariableBinding) binding3;
-// assertEquals("Not C", "C", variableBinding3.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("Not default", Modifier.NONE, variableBinding3.getModifiers()); //$NON-NLS-1$
-// assertEquals("wrong name", "fB", variableBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-//
-// qualifierName = qualifiedName.getQualifier();
-// assertTrue("Not a simple name", qualifierName.isSimpleName()); //$NON-NLS-1$
-// checkSourceRange(qualifierName, "field", source); //$NON-NLS-1$
-// simpleName = (SimpleName) qualifierName;
-// ITypeBinding typeBinding7 = simpleName.resolveTypeBinding();
-// assertNotNull("No typeBinding7", typeBinding7); //$NON-NLS-1$
-// assertEquals("Not a C", "C", typeBinding7.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// IBinding binding4 = simpleName.resolveBinding();
-// assertNotNull("No binding4", binding4); //$NON-NLS-1$
-// assertTrue("VariableBinding", binding4 instanceof IVariableBinding); //$NON-NLS-1$
-// IVariableBinding variableBinding4 = (IVariableBinding) binding4;
-// assertEquals("Not Test", "Test", variableBinding4.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("Not public", Modifier.PUBLIC, variableBinding4.getModifiers()); //$NON-NLS-1$
-// assertEquals("wrong name", "field", variableBinding4.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("wrong return type", "C", variableBinding4.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-//
-// /**
-// * QualifiedName as TypeReference
-// */
-// public void test0228() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0228", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0);
-// assertTrue("ReturnStatement", node2 instanceof ReturnStatement); //$NON-NLS-1$
-// ReturnStatement returnStatement = (ReturnStatement) node2;
-// Expression expr = returnStatement.getExpression();
-// checkSourceRange(expr, "test0228.Test.foo()", source); //$NON-NLS-1$
-// assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$
-// FunctionInvocation methodInvocation = (FunctionInvocation) expr;
-// Expression qualifier = methodInvocation.getExpression();
-// assertNotNull("no qualifier", qualifier); //$NON-NLS-1$
-// assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$
-// QualifiedName qualifiedName = (QualifiedName) qualifier;
-// checkSourceRange(qualifiedName, "test0228.Test", source); //$NON-NLS-1$
-// ITypeBinding typeBinding = qualifiedName.resolveTypeBinding();
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong type", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// IBinding binding = qualifiedName.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertEquals("Not a type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
-//
-// }
-
-// /**
-// * FunctionInvocation
-// */
-// public void test0229() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0229", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
-// ExpressionStatement expressionStatement = (ExpressionStatement) node2;
-// Expression expr = expressionStatement.getExpression();
-// assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$
-// checkSourceRange(expr, "System.err.println()", source); //$NON-NLS-1$
-// FunctionInvocation methodInvocation = (FunctionInvocation) expr;
-// Expression qualifier = methodInvocation.getExpression();
-// assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$
-// QualifiedName qualifiedName = (QualifiedName) qualifier;
-// ITypeBinding typeBinding = qualifier.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// IBinding binding = qualifiedName.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
-// IVariableBinding variableBinding = (IVariableBinding) binding;
-// assertEquals("wrong name", "err", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// SimpleName methodName = methodInvocation.getName();
-// IBinding binding2 = methodName.resolveBinding();
-// assertNotNull("No binding2", binding2); //$NON-NLS-1$
-// }
-
-// /**
-// * FunctionInvocation
-// */
-// public void test0230() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0230", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 1, 0);
-// assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
-// ExpressionStatement expressionStatement = (ExpressionStatement) node2;
-// Expression expr = expressionStatement.getExpression();
-// assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$
-// checkSourceRange(expr, "err.println()", source); //$NON-NLS-1$
-// FunctionInvocation methodInvocation = (FunctionInvocation) expr;
-// Expression qualifier = methodInvocation.getExpression();
-// assertTrue("SimpleName", qualifier instanceof SimpleName); //$NON-NLS-1$
-// SimpleName name = (SimpleName) qualifier;
-// IBinding binding = name.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertEquals("Wrong name", "err", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// ITypeBinding typeBinding = name.resolveTypeBinding();
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wron type name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-
-// /**
-// * FunctionInvocation
-// */
-// public void test0231() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0231", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertTrue("ExpressionStatement", node2 instanceof ExpressionStatement); //$NON-NLS-1$
-// ExpressionStatement expressionStatement = (ExpressionStatement) node2;
-// Expression expr = expressionStatement.getExpression();
-// assertTrue("FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$
-// checkSourceRange(expr, "System.err.println()", source); //$NON-NLS-1$
-// FunctionInvocation methodInvocation = (FunctionInvocation) expr;
-// Expression qualifier = methodInvocation.getExpression();
-// assertTrue("QualifiedName", qualifier instanceof QualifiedName); //$NON-NLS-1$
-// QualifiedName qualifiedName = (QualifiedName) qualifier;
-// ITypeBinding typeBinding = qualifier.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "PrintStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// IBinding binding = qualifiedName.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertTrue("VariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
-// IVariableBinding variableBinding = (IVariableBinding) binding;
-// assertEquals("wrong name", "err", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// SimpleName methodName = methodInvocation.getName();
-// IBinding binding2 = methodName.resolveBinding();
-// assertNotNull("No binding2", binding2); //$NON-NLS-1$
-// Name name = qualifiedName.getQualifier();
-// assertTrue("SimpleName", name.isSimpleName()); //$NON-NLS-1$
-// SimpleName simpleName = (SimpleName) name;
-// ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
-// assertNotNull("No typeBinding2", typeBinding2); //$NON-NLS-1$
-// assertEquals("wrong type name", "System", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-
-// /**
-// * FunctionInvocation
-// */
-// public void test0232() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0232", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// ASTNode node2 = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertTrue("VariableDeclarationStatement", node2 instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node2;
-// List fragments = variableDeclarationStatement.fragments();
-// assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
-// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
-// Expression initialization = variableDeclarationFragment.getInitializer();
-// ITypeBinding typeBinding = initialization.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// assertTrue("Not a primitive type", typeBinding.isPrimitive()); //$NON-NLS-1$
-// assertEquals("wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertTrue("QualifiedName", initialization instanceof QualifiedName); //$NON-NLS-1$
-// QualifiedName qualifiedName = (QualifiedName) initialization;
-// SimpleName simpleName = qualifiedName.getName();
-// ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
-// assertTrue("Not a primitive type", typeBinding2.isPrimitive()); //$NON-NLS-1$
-// assertEquals("wrong name", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// IBinding binding = simpleName.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertTrue("IVariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
-// IVariableBinding variableBinding = (IVariableBinding) binding;
-// assertNull("No declaring class", variableBinding.getDeclaringClass()); //$NON-NLS-1$
-// }
-
-// /**
-// * Checking that only syntax errors are reported for the MALFORMED tag
-// */
-// public void test0233() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0233", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("Expression should not be null", result); //$NON-NLS-1$
-// assertTrue("The compilation unit is malformed", !isMalformed(result)); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit unit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$
-// assertEquals("No problem found", 1, unit.getMessages().length); //$NON-NLS-1$
-// assertEquals("No problem found", 1, unit.getProblems().length); //$NON-NLS-1$
-// }
-//
-// /**
-// * Checking that null is returned for a resolveBinding if the type is unknown
-// */
-// public void test0234() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0234", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$
-// JavaScriptUnit unit = (JavaScriptUnit) result;
-// assertEquals("No problem found", 1, unit.getMessages().length); //$NON-NLS-1$
-// assertEquals("No problem found", 1, unit.getProblems().length); //$NON-NLS-1$
-// assertTrue("VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
-// List fragments = fieldDeclaration.fragments();
-// assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
-// VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
-// IVariableBinding variableBinding = fragment.resolveBinding();
-// assertNull("binding not null", variableBinding); //$NON-NLS-1$
-// }
-
- /**
- * Checking that null is returned for a resolveBinding if the type is unknown
- */
- public void test0235() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0235", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("The fiels is not malformed", !isMalformed(node)); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("problems found", 0, unit.getMessages().length); //$NON-NLS-1$
- assertEquals("problems found", 0, unit.getProblems().length); //$NON-NLS-1$
- assertTrue("VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding); //$NON-NLS-1$
- }
-
- /**
- * Test the removal of a IField inside a CU that has an initializer
- */
- public void test0236() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0236", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// IType type = sourceUnit.getType("Test"); //$NON-NLS-1$
-// assertNotNull("No type", type); //$NON-NLS-1$
- IField field = sourceUnit.getField("i"); //$NON-NLS-1$
- assertNotNull("No field", field); //$NON-NLS-1$
- field.delete(true, null);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=9452
- */
- public void test0237() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "junit.framework", "TestCase.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- }
-
-// /**
-// * Check ThisExpression
-// * @deprecated using deprecated code
-// */
-// public void test0238() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0238", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// char[] source = sourceUnit.getSource().toCharArray();
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
-// TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
-// TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration();
-// Object o = typeDecl.bodyDeclarations().get(0);
-// assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$
-// FunctionDeclaration methodDecl = (FunctionDeclaration) o;
-// Block block = methodDecl.getBody();
-// List statements = block.statements();
-// assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$
-// Statement stmt = (Statement) statements.get(0);
-// assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$
-// ReturnStatement returnStatement = (ReturnStatement) stmt;
-// Expression expr = returnStatement.getExpression();
-// assertTrue("Not a method invocation", expr instanceof FunctionInvocation); //$NON-NLS-1$
-// FunctionInvocation methodInvocation = (FunctionInvocation) expr;
-// checkSourceRange(methodInvocation, "Test.this.bar()", source); //$NON-NLS-1$
-// Expression qualifier = methodInvocation.getExpression();
-// assertTrue("Not a ThisExpression", qualifier instanceof ThisExpression); //$NON-NLS-1$
-// ThisExpression thisExpression = (ThisExpression) qualifier;
-// Name name = thisExpression.getQualifier();
-// IBinding binding = name.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertEquals("wrong name", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-//
-// /**
-// * Check ThisExpression
-// * @deprecated using deprecated code
-// */
-// public void test0239() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0239", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 0);
-// assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
-// TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
-// TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration();
-// Object o = typeDecl.bodyDeclarations().get(0);
-// assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$
-// FunctionDeclaration methodDecl = (FunctionDeclaration) o;
-// Block block = methodDecl.getBody();
-// List statements = block.statements();
-// assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$
-// Statement stmt = (Statement) statements.get(0);
-// assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$
-// ReturnStatement returnStatement = (ReturnStatement) stmt;
-// Expression expr = returnStatement.getExpression();
-// assertTrue("Not a SuperMethodInvocation", expr instanceof SuperMethodInvocation); //$NON-NLS-1$
-// SuperMethodInvocation superMethodInvocation = (SuperMethodInvocation) expr;
-// Name name = superMethodInvocation.getQualifier();
-// IBinding binding = name.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertTrue("A type binding", binding instanceof ITypeBinding); //$NON-NLS-1$
-// assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// Name methodName = superMethodInvocation.getName();
-// IBinding binding2 = methodName.resolveBinding();
-// assertNotNull("No binding2", binding2); //$NON-NLS-1$
-// assertTrue("No an IFunctionBinding", binding2 instanceof IFunctionBinding); //$NON-NLS-1$
-// IFunctionBinding methodBinding = (IFunctionBinding) binding2;
-// assertEquals("Not bar", "bar", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("Not T", "T", methodBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-
-// /**
-// * Check FieldAccess
-// * @deprecated using deprecated code
-// */
-// public void test0240() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0240", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
-// TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
-// TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration();
-// Object o = typeDecl.bodyDeclarations().get(0);
-// assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$
-// FunctionDeclaration methodDecl = (FunctionDeclaration) o;
-// Block block = methodDecl.getBody();
-// List statements = block.statements();
-// assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$
-// Statement stmt = (Statement) statements.get(0);
-// assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$
-// ReturnStatement returnStatement = (ReturnStatement) stmt;
-// Expression expr = returnStatement.getExpression();
-// assertTrue("Not a field access", expr instanceof FieldAccess); //$NON-NLS-1$
-// FieldAccess fieldAccess = (FieldAccess) expr;
-// Expression qualifier = fieldAccess.getExpression();
-// assertTrue("Not a ThisExpression", qualifier instanceof ThisExpression); //$NON-NLS-1$
-// ThisExpression thisExpression = (ThisExpression) qualifier;
-// Name name = thisExpression.getQualifier();
-// IBinding binding = name.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// Name fieldName = fieldAccess.getName();
-// IBinding binding2 = fieldName.resolveBinding();
-// assertNotNull("No binding2", binding2); //$NON-NLS-1$
-// assertEquals("Wrong name", "f", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("Wrong modifier", Modifier.PUBLIC, binding2.getModifiers()); //$NON-NLS-1$
-// ITypeBinding typeBinding = fieldName.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// assertEquals("Not int", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-//
- /**
- * Check order of body declarations
- */
- public void test0241() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0241", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0);
-// assertTrue("Not a type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// assertTrue("Not a declaration", ((TypeDeclaration) node).getName().isDeclaration()); //$NON-NLS-1$
-// assertEquals("Wrong size", 11, ((TypeDeclaration)node).bodyDeclarations().size()); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
-// node = getASTNode((JavaScriptUnit) result, 0, 2);
-// assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// node = getASTNode((JavaScriptUnit) result, 0, 3);
-// assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 2);
- assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 3);
- assertTrue("Not a field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 4);
- assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 5);
- assertTrue("Not a field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 6);
- assertTrue("Not a field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- node = getASTNode((JavaScriptUnit) result, 0, 7);
- assertTrue("Not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
-// node = getASTNode((JavaScriptUnit) result, 0, 10);
-// assertTrue("Not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- }
-
-// /**
-// * Check ThisExpression
-// * @deprecated using deprecated code
-// */
-// public void test0242() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0242", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 0);
-// assertTrue("Not a type declaration statement", node instanceof TypeDeclarationStatement); //$NON-NLS-1$
-// TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
-// TypeDeclaration typeDecl = typeDeclarationStatement.getTypeDeclaration();
-// Object o = typeDecl.bodyDeclarations().get(0);
-// assertTrue("Not a method", o instanceof FunctionDeclaration); //$NON-NLS-1$
-// FunctionDeclaration methodDecl = (FunctionDeclaration) o;
-// Block block = methodDecl.getBody();
-// List statements = block.statements();
-// assertEquals("Not 1", 1, statements.size()); //$NON-NLS-1$
-// Statement stmt = (Statement) statements.get(0);
-// assertTrue("Not a return statement", stmt instanceof ReturnStatement); //$NON-NLS-1$
-// ReturnStatement returnStatement = (ReturnStatement) stmt;
-// Expression expr = returnStatement.getExpression();
-// assertTrue("Not a SuperFieldAccess", expr instanceof SuperFieldAccess); //$NON-NLS-1$
-// SuperFieldAccess superFieldAccess = (SuperFieldAccess) expr;
-// Name name = superFieldAccess.getQualifier();
-// IBinding binding = name.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertTrue("A type binding", binding instanceof ITypeBinding); //$NON-NLS-1$
-// assertEquals("Not Test", "Test", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// Name fieldName = superFieldAccess.getName();
-// IBinding binding2 = fieldName.resolveBinding();
-// assertNotNull("No binding2", binding2); //$NON-NLS-1$
-// assertTrue("No an IVariableBinding", binding2 instanceof IVariableBinding); //$NON-NLS-1$
-// IVariableBinding variableBinding = (IVariableBinding) binding2;
-// assertEquals("Not f", "f", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("Not T", "T", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// ITypeBinding typeBinding2 = fieldName.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
-// assertEquals("Not int", "int", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-
- /**
- * Check catch clause positions:
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10570
- */
- public void test0243() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0243", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a try statement", node instanceof TryStatement); //$NON-NLS-1$
- TryStatement tryStatement = (TryStatement) node;
- List catchClauses = tryStatement.catchClauses();
- assertEquals("wrong size", 1, catchClauses.size()); //$NON-NLS-1$
- CatchClause catchClause = (CatchClause) catchClauses.get(0);
- checkSourceRange(catchClause, "catch (e){m();}", source); //$NON-NLS-1$
- }
-
- /**
- * Check catch clause positions:
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10570
- */
- public void test0244() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0244", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a try statement", node instanceof TryStatement); //$NON-NLS-1$
- TryStatement tryStatement = (TryStatement) node;
- List catchClauses = tryStatement.catchClauses();
- assertEquals("wrong size", 1, catchClauses.size()); //$NON-NLS-1$
- CatchClause catchClause = (CatchClause) catchClauses.get(0);
- checkSourceRange(catchClause, "catch (e){m();}", source); //$NON-NLS-1$
-// catchClause = (CatchClause) catchClauses.get(1);
-// checkSourceRange(catchClause, "catch(e) {}", source); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=10587
- */
- public void test0245() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0245", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expr = returnStatement.getExpression();
- assertTrue("not a name", expr instanceof Name); //$NON-NLS-1$
- Name name = (Name) expr;
- IBinding binding = name.resolveBinding();
- assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Not i", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Not Number", "Number", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ASTNode declaringNode = unit.findDeclaringNode(variableBinding);
- assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$
- assertTrue("Not a VariableDeclarationFragment", declaringNode instanceof VariableDeclarationFragment); //$NON-NLS-1$
- }
-
-// /**
-// * Test binding resolution for import declaration
-// */
-// public void test0246() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0246", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit unit = (JavaScriptUnit) result;
-// List imports = unit.imports();
-// assertEquals("wrong imports size", 2, imports.size()); //$NON-NLS-1$
-// ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0);
-// assertTrue("Not on demand", importDeclaration.isOnDemand()); //$NON-NLS-1$
-// checkSourceRange(importDeclaration, "import java.util.*;", source); //$NON-NLS-1$
-// IBinding binding = importDeclaration.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$
-// assertEquals("Wrong name", "java.util", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// importDeclaration = (ImportDeclaration) imports.get(1);
-// assertTrue("On demand", !importDeclaration.isOnDemand()); //$NON-NLS-1$
-// checkSourceRange(importDeclaration, "import java.io.IOException;", source); //$NON-NLS-1$
-// binding = importDeclaration.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
-// assertEquals("Wrong name", "IOException", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-//
-// /**
-// * Test binding resolution for import declaration
-// */
-// public void test0247() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0247", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit unit = (JavaScriptUnit) result;
-// PackageDeclaration packageDeclaration = unit.getPackage();
-// checkSourceRange(packageDeclaration, "package test0247;", source); //$NON-NLS-1$
-// IPackageBinding binding = packageDeclaration.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$
-// assertEquals("Wrong name", "test0247", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592
- */
- public void test0248() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0248", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 1, parameters.size()); //$NON-NLS-1$
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- Name name = singleVariableDeclaration.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong type", "any", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592
-// */
-// public void test0249() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0249", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 2, 1);
-// assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
-// ExpressionStatement expressionStatement = (ExpressionStatement) node;
-// Expression expression = expressionStatement.getExpression();
-// assertTrue("Not an assignment", expression instanceof Assignment); //$NON-NLS-1$
-// Assignment assignment = (Assignment) expression;
-// Expression leftHandSide = assignment.getLeftHandSide();
-// assertTrue("Not a qualified name", leftHandSide instanceof QualifiedName); //$NON-NLS-1$
-// QualifiedName qualifiedName = (QualifiedName) leftHandSide;
-// Name simpleName = qualifiedName.getName();
-// IBinding binding = simpleName.resolveBinding();
-// assertNotNull("no binding", binding); //$NON-NLS-1$
-// assertTrue("Not a IVariableBinding", binding instanceof IVariableBinding); //$NON-NLS-1$
-// IVariableBinding variableBinding = (IVariableBinding) binding;
-// assertEquals("Wrong name", "k", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("Wrong modifier", Modifier.STATIC, variableBinding.getModifiers()); //$NON-NLS-1$
-// assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("Wrong declaring class name", "j", variableBinding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-//
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592
-// */
-// public void test0250() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0250", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
-// FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
-// List parameters = methodDeclaration.parameters();
-// assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
-// SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
-// Name name = singleVariableDeclaration.getName();
-// IBinding binding = name.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$
-// IVariableBinding variableBinding = (IVariableBinding) binding;
-// assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-//
-// /**
-// * Check qualified name resolution for static fields
-// */
-// public void test0251() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0251", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertTrue("Not a ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
-// ExpressionStatement expressionStatement = (ExpressionStatement) node;
-// Expression expression = expressionStatement.getExpression();
-// assertTrue("Not a method invocation", expression instanceof FunctionInvocation); //$NON-NLS-1$
-// FunctionInvocation methodInvocation = (FunctionInvocation) expression;
-// checkSourceRange(methodInvocation, "java.lang.System.out.println()", source); //$NON-NLS-1$
-// Expression qualifier = methodInvocation.getExpression();
-// assertTrue("Not a qualified name", qualifier instanceof QualifiedName); //$NON-NLS-1$
-// checkSourceRange(qualifier, "java.lang.System.out", source); //$NON-NLS-1$
-// QualifiedName qualifiedName = (QualifiedName) qualifier;
-// Name typeName = qualifiedName.getQualifier();
-// assertTrue("Not a QualifiedName", typeName instanceof QualifiedName); //$NON-NLS-1$
-// QualifiedName qualifiedTypeName = (QualifiedName) typeName;
-// IBinding binding = qualifiedTypeName.getName().resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertEquals("Wrong name", "System", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// binding = qualifiedTypeName.getQualifier().resolveBinding();
-// assertNotNull("No binding2", binding); //$NON-NLS-1$
-// assertEquals("Wrong type binding", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$
-// }
-//
-// /**
-// * Check binding for anonymous class
-// */
-// public void test0252() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0252", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
-// assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
-// ReturnStatement returnStatement = (ReturnStatement) node;
-// Expression expression = returnStatement.getExpression();
-// assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
-// ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
-// IFunctionBinding methodBinding = classInstanceCreation.resolveConstructorBinding();
-// assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$
-// assertTrue("Not a constructor", methodBinding.isConstructor()); //$NON-NLS-1$
-// assertTrue("Not an anonymous class", methodBinding.getDeclaringClass().isAnonymous()); //$NON-NLS-1$
-// assertEquals("Not an anonymous class of java.lang.Object", "Object", methodBinding.getDeclaringClass().getSuperclass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("Not an anonymous class of java.lang.Object", "java.lang", methodBinding.getDeclaringClass().getSuperclass().getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-
- /**
- * Check binding for allocation expression
- */
- public void test0253() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0253", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- IFunctionBinding methodBinding = classInstanceCreation.resolveConstructorBinding();
- assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$
- assertTrue("Not a constructor", methodBinding.isConstructor()); //$NON-NLS-1$
-// assertEquals("Wrong size", 1, methodBinding.getParameterTypes().length); //$NON-NLS-1$
-// assertEquals("Wrong type", "String", methodBinding.getParameterTypes()[0].getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-// /**
-// * Check binding for allocation expression
-// */
-// public void test0254() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0254", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 1, 0);
-// assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
-// ReturnStatement returnStatement = (ReturnStatement) node;
-// Expression expression = returnStatement.getExpression();
-// assertTrue("Not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
-// ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
-// IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertEquals("wrong type", "C", binding.getDeclaringClass().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-
-
-// /**
-// * Check binding for allocation expression
-// */
-// public void test0255() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0255", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
-// ExpressionStatement expressionStatement = (ExpressionStatement) node;
-// Expression expression = expressionStatement.getExpression();
-// assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$
-// FunctionInvocation methodInvocation = (FunctionInvocation) expression;
-// List arguments = methodInvocation.arguments();
-// assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
-// Expression expression2 = (Expression) arguments.get(0);
-// assertTrue("Not a CastExpression", expression2 instanceof CastExpression); //$NON-NLS-1$
-// CastExpression castExpression = (CastExpression) expression2;
-// Type type = castExpression.getType();
-// ITypeBinding binding = type.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$
-// }
-
-// /**
-// * Check binding for allocation expression
-// */
-// public void test0256() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0256", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
-// ExpressionStatement expressionStatement = (ExpressionStatement) node;
-// Expression expression = expressionStatement.getExpression();
-// assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$
-// FunctionInvocation methodInvocation = (FunctionInvocation) expression;
-// List arguments = methodInvocation.arguments();
-// assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
-// Expression expression2 = (Expression) arguments.get(0);
-// assertTrue("Not a CastExpression", expression2 instanceof CastExpression); //$NON-NLS-1$
-// CastExpression castExpression = (CastExpression) expression2;
-// Type type = castExpression.getType();
-// assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
-// SimpleType simpleType = (SimpleType) type;
-// ITypeBinding binding = type.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertTrue("Not a class", binding.isClass()); //$NON-NLS-1$
-// Name name = simpleType.getName();
-// IBinding binding2 = name.resolveBinding();
-// assertNotNull("No binding2", binding2); //$NON-NLS-1$
-// assertEquals("Wrong type", "Object", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-//
-// /**
-// * Check binding for allocation expression
-// */
-// public void test0257() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0257", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
-// ExpressionStatement expressionStatement = (ExpressionStatement) node;
-// Expression expression = expressionStatement.getExpression();
-// assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$
-// FunctionInvocation methodInvocation = (FunctionInvocation) expression;
-// List arguments = methodInvocation.arguments();
-// assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
-// Expression expression2 = (Expression) arguments.get(0);
-// assertTrue("Not a CastExpression", expression2 instanceof CastExpression); //$NON-NLS-1$
-// CastExpression castExpression = (CastExpression) expression2;
-// Type type = castExpression.getType();
-// assertTrue("Not a primitive type", type.isPrimitiveType()); //$NON-NLS-1$
-// PrimitiveType primitiveType = (PrimitiveType) type;
-// assertEquals("Not int", PrimitiveType.INT, primitiveType.getPrimitiveTypeCode()); //$NON-NLS-1$
-// }
-
-// /**
-// * Check binding for allocation expression
-// */
-// public void test0258() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0258", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
-// assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
-// ExpressionStatement expressionStatement = (ExpressionStatement) node;
-// Expression expression = expressionStatement.getExpression();
-// assertTrue("Not a FunctionInvocation", expression instanceof FunctionInvocation); //$NON-NLS-1$
-// FunctionInvocation methodInvocation = (FunctionInvocation) expression;
-// List arguments = methodInvocation.arguments();
-// assertEquals("wrong size", 1, arguments.size()); //$NON-NLS-1$
-// Expression expression2 = (Expression) arguments.get(0);
-// assertTrue("Not a CastExpression", expression2 instanceof CastExpression); //$NON-NLS-1$
-// CastExpression castExpression = (CastExpression) expression2;
-// Type type = castExpression.getType();
-// assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
-// SimpleType simpleType = (SimpleType) type;
-// ITypeBinding binding = type.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// assertTrue("Not a class", binding.isClass()); //$NON-NLS-1$
-// Name name = simpleType.getName();
-// IBinding binding2 = name.resolveBinding();
-// assertNotNull("No binding2", binding2); //$NON-NLS-1$
-// assertEquals("Wrong type", "Object", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10663
- */
- public void test0259() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0259", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- }
-//
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10592
-// */
-// public void test0260() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0260", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
-// assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
-// FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
-// List parameters = methodDeclaration.parameters();
-// assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
-// SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
-// IBinding binding = singleVariableDeclaration.resolveBinding();
-// assertNotNull("No binding", binding); //$NON-NLS-1$
-// Name name = singleVariableDeclaration.getName();
-// assertTrue("Not a simple name", name instanceof SimpleName); //$NON-NLS-1$
-// SimpleName simpleName = (SimpleName) name;
-// assertEquals("Wrong name", "i", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
-// IBinding binding2 = name.resolveBinding();
-// assertNotNull("No binding", binding2); //$NON-NLS-1$
-// assertTrue("binding == binding2", binding == binding2); //$NON-NLS-1$
-// assertTrue("Not a variable binding", binding2 instanceof IVariableBinding); //$NON-NLS-1$
-// IVariableBinding variableBinding = (IVariableBinding) binding2;
-// assertEquals("Wrong name", "i", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertEquals("Wrong type", "int", variableBinding.getType().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10676
- */
- public void test0262() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0262", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expr = expressionStatement.getExpression();
- assertTrue("Not a FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expr;
- List arguments = methodInvocation.arguments();
- assertEquals("Wrong argument list size", 1, arguments.size()); //$NON-NLS-1$
- Expression expr2 = (Expression) arguments.get(0);
- assertTrue("Not a class instance creation", expr2 instanceof ClassInstanceCreation); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expr2;
- arguments = classInstanceCreation.arguments();
- assertEquals("Wrong size", 1, arguments.size()); //$NON-NLS-1$
- Expression expression2 = (Expression) arguments.get(0);
- assertTrue("Not a string literal", expression2 instanceof StringLiteral); //$NON-NLS-1$
- StringLiteral stringLiteral = (StringLiteral) expression2;
- ITypeBinding typeBinding = stringLiteral.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "String", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10700
- */
- public void test0263() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0263", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expr = expressionStatement.getExpression();
- assertTrue("Not a FunctionInvocation", expr instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expr;
- List arguments = methodInvocation.arguments();
- assertEquals("Wrong argument list size", 1, arguments.size()); //$NON-NLS-1$
- Expression expr2 = (Expression) arguments.get(0);
- assertTrue("Not a simple name", expr2 instanceof SimpleName); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expr2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10699
- */
-// public void test0264() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0264", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
-// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
-// List fragments = variableDeclarationStatement.fragments();
-// assertEquals("Wrong fragment size", 1, fragments.size()); //$NON-NLS-1$
-// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
-// Expression expression = variableDeclarationFragment.getInitializer();
-// assertTrue("Not a classinstancecreation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
-// ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
-// AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
-// assertNotNull("No anonymousclassdeclaration", anonymousClassDeclaration); //$NON-NLS-1$
-// String expectedSourceRange =
-// "{\n"+ //$NON-NLS-1$
-// " void m(int k){\n"+ //$NON-NLS-1$
-// " k= i;\n"+ //$NON-NLS-1$
-// " }\n"+ //$NON-NLS-1$
-// " }"; //$NON-NLS-1$
-// checkSourceRange(anonymousClassDeclaration, expectedSourceRange, source);
-// List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
-// assertEquals("Wrong size", 1, bodyDeclarations.size()); //$NON-NLS-1$
-// BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
-// assertTrue("Not a method declaration", bodyDeclaration instanceof FunctionDeclaration); //$NON-NLS-1$
-// FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
-// assertEquals("Wrong name", "m", methodDeclaration.getName().getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10698
- */
- public void test0265() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0265", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- }
-
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
-// */
-// public void test0266() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0266", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
-// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
-// Type type = variableDeclarationStatement.getType();
-// checkSourceRange(type, "Inner\\u005b]", source); //$NON-NLS-1$
-// assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
-// ArrayType arrayType = (ArrayType) type;
-// Type type2 = arrayType.getElementType();
-// assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
-// SimpleType simpleType = (SimpleType) type2;
-// checkSourceRange(simpleType, "Inner", source); //$NON-NLS-1$
-// Name name = simpleType.getName();
-// assertTrue("not a simple name", name.isSimpleName()); //$NON-NLS-1$
-// SimpleName simpleName = (SimpleName) name;
-// checkSourceRange(simpleName, "Inner", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
-// */
-// public void test0267() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0267", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
-// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
-// Type type = variableDeclarationStatement.getType();
-// checkSourceRange(type, "Inner[]", source); //$NON-NLS-1$
-// assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
-// ArrayType arrayType = (ArrayType) type;
-// Type type2 = arrayType.getElementType();
-// assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
-// SimpleType simpleType = (SimpleType) type2;
-// checkSourceRange(simpleType, "Inner", source); //$NON-NLS-1$
-// Name name = simpleType.getName();
-// assertTrue("not a simple name", name.isSimpleName()); //$NON-NLS-1$
-// SimpleName simpleName = (SimpleName) name;
-// checkSourceRange(simpleName, "Inner", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
-// */
-// public void test0268() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0268", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
-// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
-// Type type = variableDeclarationStatement.getType();
-// checkSourceRange(type, "test0268.Test.Inner[]", source); //$NON-NLS-1$
-// assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
-// ArrayType arrayType = (ArrayType) type;
-// Type type2 = arrayType.getElementType();
-// assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
-// SimpleType simpleType = (SimpleType) type2;
-// checkSourceRange(simpleType, "test0268.Test.Inner", source); //$NON-NLS-1$
-// Name name = simpleType.getName();
-// assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
-// checkSourceRange(name, "test0268.Test.Inner", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
-// */
-// public void test0269() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0269", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
-// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
-// Type type = variableDeclarationStatement.getType();
-// checkSourceRange(type, "test0269.Test.Inner[/**/]", source); //$NON-NLS-1$
-// assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
-// ArrayType arrayType = (ArrayType) type;
-// Type type2 = arrayType.getElementType();
-// assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
-// SimpleType simpleType = (SimpleType) type2;
-// checkSourceRange(simpleType, "test0269.Test.Inner", source); //$NON-NLS-1$
-// Name name = simpleType.getName();
-// assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
-// checkSourceRange(name, "test0269.Test.Inner", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
-// */
-// public void test0270() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0270", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
-// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
-// Type type = variableDeclarationStatement.getType();
-// checkSourceRange(type, "test0270.Test.Inner", source); //$NON-NLS-1$
-// assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
-// SimpleType simpleType = (SimpleType) type;
-// Name name = simpleType.getName();
-// assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
-// checkSourceRange(name, "test0270.Test.Inner", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10759
-// */
-// public void test0271() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0271", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
-// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
-// Type type = variableDeclarationStatement.getType();
-// checkSourceRange(type, "test0271.Test.Inner[]", source); //$NON-NLS-1$
-// assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
-// ArrayType arrayType = (ArrayType) type;
-// Type type2 = arrayType.getElementType();
-// assertTrue("Not a simple type", type2.isSimpleType()); //$NON-NLS-1$
-// SimpleType simpleType = (SimpleType) type2;
-// checkSourceRange(simpleType, "test0271.Test.Inner", source); //$NON-NLS-1$
-// Name name = simpleType.getName();
-// assertTrue("not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
-// checkSourceRange(name, "test0271.Test.Inner", source); //$NON-NLS-1$
-// }
-//
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843
- */
- public void test0272() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0272", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a For statement", node instanceof ForStatement); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- checkSourceRange(forStatement, "for (var i= 0; i < 10; i++) foo();", source); //$NON-NLS-1$
- Statement action = forStatement.getBody();
- checkSourceRange(action, "foo();", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843
- */
- public void test0273() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0273", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a For statement", node instanceof ForStatement); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- checkSourceRange(forStatement, "for (var i= 0; i < 10; i++) { foo(); }", source); //$NON-NLS-1$
- Statement action = forStatement.getBody();
- checkSourceRange(action, "{ foo(); }", source); //$NON-NLS-1$
- assertTrue("Not a block", action instanceof Block); //$NON-NLS-1$
- Block block = (Block) action;
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(0);
- checkSourceRange(stmt, "foo();", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843
- */
- public void test0274() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0274", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not a While statement", node instanceof WhileStatement); //$NON-NLS-1$
- WhileStatement whileStatement = (WhileStatement) node;
- checkSourceRange(whileStatement, "while (i < 10) { foo(i++); }", source); //$NON-NLS-1$
- Statement action = whileStatement.getBody();
- checkSourceRange(action, "{ foo(i++); }", source); //$NON-NLS-1$
- assertTrue("Not a block", action instanceof Block); //$NON-NLS-1$
- Block block = (Block) action;
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement stmt = (Statement) statements.get(0);
- checkSourceRange(stmt, "foo(i++);", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10843
- */
- public void test0275() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0275", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not a While statement", node instanceof WhileStatement); //$NON-NLS-1$
- WhileStatement whileStatement = (WhileStatement) node;
- checkSourceRange(whileStatement, "while (i < 10) foo(i++);", source); //$NON-NLS-1$
- Statement action = whileStatement.getBody();
- checkSourceRange(action, "foo(i++);", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10798
- */
- public void test0276() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0276", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- String expectedSource =
- "function foo() {\n" + //$NON-NLS-1$
- " foo();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration, expectedSource, source);
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " foo();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration.getBody(), expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10798
- */
- public void test0277() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0277", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- String expectedSource =
- "function foo() {\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration, expectedSource, source);
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration.getBody(), expectedSource, source);
- }
-
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10861
-// */
-// public void test0278() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0278", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 0);
-// assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
-// checkSourceRange(fieldDeclaration, "Class c = java.lang.String.class;", source); //$NON-NLS-1$
-// List fragments = fieldDeclaration.fragments();
-// assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
-// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
-// Expression expression = variableDeclarationFragment.getInitializer();
-// assertTrue("Not a type literal", expression instanceof TypeLiteral); //$NON-NLS-1$
-// ITypeBinding typeBinding = expression.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-//
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10861
-// */
-// public void test0279() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0279", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 0,0);
-// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
-// checkSourceRange(variableDeclarationStatement, "Class c = java.lang.String.class;", source); //$NON-NLS-1$
-// List fragments = variableDeclarationStatement.fragments();
-// assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
-// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
-// Expression expression = variableDeclarationFragment.getInitializer();
-// assertTrue("Not a type literal", expression instanceof TypeLiteral); //$NON-NLS-1$
-// ITypeBinding typeBinding = expression.resolveTypeBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10865
- * Check well known types
- */
- public void test0280() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0280", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- AST newAst = result.getAST();
- ITypeBinding typeBinding = newAst.resolveWellKnownType("Boolean"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Boolean", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("String"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "String", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- typeBinding = newAst.resolveWellKnownType("Number"); //$NON-NLS-1$
- assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("short"); //$NON-NLS-1$
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "short", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("int"); //$NON-NLS-1$
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("long"); //$NON-NLS-1$
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "long", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("float"); //$NON-NLS-1$
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "float", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("double"); //$NON-NLS-1$
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "double", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("void"); //$NON-NLS-1$
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "void", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Object"); //$NON-NLS-1$
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "Object", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("java.lang.String"); //$NON-NLS-1$
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "String", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("java.lang.StringBuffer"); //$NON-NLS-1$
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "StringBuffer", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Throwable"); //$NON-NLS-1$
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "Throwable", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Exception"); //$NON-NLS-1$
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "Exception", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("java.lang.RuntimeException"); //$NON-NLS-1$
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "RuntimeException", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Error"); //$NON-NLS-1$
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "Error", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Class"); //$NON-NLS-1$
-// assertNotNull("No typeBinding", typeBinding); //$NON-NLS-1$
-// assertEquals("Wrong name", "Class", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Runnable"); //$NON-NLS-1$
-// assertNull("typeBinding not null", typeBinding); //$NON-NLS-1$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Cloneable"); //$NON-NLS-1$
-// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
-// typeBinding = newAst.resolveWellKnownType("java.io.Serializable"); //$NON-NLS-1$
-// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Boolean"); //$NON-NLS-1$
-// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Byte"); //$NON-NLS-1$
-// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Character"); //$NON-NLS-1$
-// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Double"); //$NON-NLS-1$
-// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Float"); //$NON-NLS-1$
-// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Integer"); //$NON-NLS-1$
-// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Long"); //$NON-NLS-1$
-// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Short"); //$NON-NLS-1$
-// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
-// typeBinding = newAst.resolveWellKnownType("java.lang.Void"); //$NON-NLS-1$
-// assertNotNull("typeBinding not null", typeBinding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0281() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0281", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a VariableDeclarationStatement declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- checkSourceRange(fieldDeclaration, "var o= /*]*/new Object()/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "new Object()", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0282() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0282", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a VariableDeclarationStatement declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- checkSourceRange(fieldDeclaration, "var b = /*]*/true/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "true", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0283() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0283", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a VariableDeclarationStatement declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- checkSourceRange(fieldDeclaration, "var c = /*]*/'c'/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "'c'", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0284() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0284", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- checkSourceRange(fieldDeclaration, "var o = /*]*/null/*[*/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "null", source); //$NON-NLS-1$
- }
-
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
-// */
-// public void test0285() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0285", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 0);
-// assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
-// checkSourceRange(fieldDeclaration, "var o = /*]*/Object.class/*[*/;", source); //$NON-NLS-1$
-// List fragments = fieldDeclaration.fragments();
-// assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
-// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
-// Expression expression = variableDeclarationFragment.getInitializer();
-// checkSourceRange(expression, "Object.class", source); //$NON-NLS-1$
-// }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0286() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0286", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- checkSourceRange(fieldDeclaration, "var i = /**/(2)/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "(2)", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0287() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0287", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a VariableDeclarationStatement declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- checkSourceRange(fieldDeclaration, "var tab = /**/new String/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "new String", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0288() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0288", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a VariableDeclarationStatement declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- checkSourceRange(fieldDeclaration, "var tab = /**/[]/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "[]", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- */
- public void test0289() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0289", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1);
- assertTrue("Not a VariableDeclarationStatement declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- checkSourceRange(fieldDeclaration, "var s = /**/tab1[0]/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "tab1[0]", source); //$NON-NLS-1$
- }
-//
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
-// */
-// public void test0290() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0290", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 0);
-// assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
-// checkSourceRange(fieldDeclaration, "var o = /*]*/new java.lang.Object()/*[*/;", source); //$NON-NLS-1$
-// List fragments = fieldDeclaration.fragments();
-// assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
-// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
-// Expression expression = variableDeclarationFragment.getInitializer();
-// checkSourceRange(expression, "new java.lang.Object()", source); //$NON-NLS-1$
-// }
-//
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10898
-// */
-// public void test0291() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0291", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit unit = (JavaScriptUnit) result;
-// assertEquals("no errors", 1, unit.getMessages().length); //$NON-NLS-1$
-// assertEquals("no errors", 1, unit.getProblems().length); //$NON-NLS-1$
-// }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10913
- */
- public void test0292() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0292", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not a FieldAccess", expression instanceof FieldAccess); //$NON-NLS-1$
- FieldAccess fieldAccess = (FieldAccess) expression;
- SimpleName simpleName = fieldAccess.getName();
- assertEquals("Wrong name", "x", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("NO binding", binding); //$NON-NLS-1$
- assertTrue("Not a variable binding", binding instanceof IVariableBinding); //$NON-NLS-1$
- assertEquals("wrong name", "x", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Expression expr = fieldAccess.getExpression();
- assertTrue("Not a simpleName", expr instanceof SimpleName); //$NON-NLS-1$
- SimpleName simpleName2 = (SimpleName) expr;
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertTrue("Not a type binding", binding2 instanceof ITypeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Test", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10933
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10935
-// */
-// public void test0293() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0293", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
-// List fragments = variableDeclarationStatement.fragments();
-// assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
-// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
-// Expression expression = variableDeclarationFragment.getInitializer();
-// assertTrue("Not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
-// ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
-// AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
-// assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$
-// String expectedSource =
-// "{\n" + //$NON-NLS-1$
-// " public void run() {\n" + //$NON-NLS-1$
-// " /*]*/foo();/*[*/\n" + //$NON-NLS-1$
-// " }\n" + //$NON-NLS-1$
-// " }"; //$NON-NLS-1$
-// checkSourceRange(anonymousClassDeclaration, expectedSource, source);
-// expectedSource =
-// "run= new Runnable() {\n" + //$NON-NLS-1$
-// " public void run() {\n" + //$NON-NLS-1$
-// " /*]*/foo();/*[*/\n" + //$NON-NLS-1$
-// " }\n" + //$NON-NLS-1$
-// " }"; //$NON-NLS-1$
-// checkSourceRange(variableDeclarationFragment, expectedSource, source);
-// }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984
- */
- public void test0294() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0294", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- String expectedSource =
- "function fails() {\n" + //$NON-NLS-1$
- " foo()\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration, expectedSource, source);
- Block block = methodDeclaration.getBody();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " foo()\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(block, expectedSource, source);
- node = getASTNode(compilationUnit, 0, 1);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10986
- */
- public void test0295() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0295", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// assertEquals("Wrong size", 2, compilationUnit.getMessages().length); //$NON-NLS-1$
-// assertEquals("Wrong size", 2, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("not a method invocation", expression instanceof FunctionInvocation); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- ITypeBinding typeBinding = methodInvocation.resolveTypeBinding();
- assertNotNull("type binding is null", typeBinding); //$NON-NLS-1$
- }
-
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984
- */
- public void test0296() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0296", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- String expectedSource =
- "function fails() {\n" + //$NON-NLS-1$
- " foo()\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(methodDeclaration, expectedSource, source);
- Block block = methodDeclaration.getBody();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " foo()\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(block, expectedSource, source);
- node = getASTNode(compilationUnit, 0, 1);
- assertTrue("Not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11037
- */
- public void test0297() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0297", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- runConversion(sourceUnit, false);
- }
-//
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=10984
-// */
-// public void test0298() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0298", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, false);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
-// assertTrue("Not a ReturnStatement", node instanceof ReturnStatement); //$NON-NLS-1$
-// ReturnStatement returnStatement = (ReturnStatement) node;
-// Expression expression = returnStatement.getExpression();
-// checkSourceRange(expression, "a().length != 3", source); //$NON-NLS-1$
-// }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104
- */
- public void test0299() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0299", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- checkSourceRange(fieldDeclaration, "var i = (/**/2/**/);", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a parenthesized expression", expression instanceof ParenthesizedExpression); //$NON-NLS-1$
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression;
- Expression expression2 = parenthesizedExpression.getExpression();
- checkSourceRange(expression2, "2", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104
- */
- public void test0300() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0300", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- checkSourceRange(fieldDeclaration, "var b = /**/true/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "true", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=10874
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11104
- */
- public void test0301() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0301", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a Field declaration", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- checkSourceRange(fieldDeclaration, "var o = /**/null/**/;", source); //$NON-NLS-1$
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- checkSourceRange(expression, "null", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11106
- */
- public void test0302() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0302", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a DoStatement", node instanceof DoStatement); //$NON-NLS-1$
- DoStatement doStatement = (DoStatement) node;
- String expectedSource =
- "do\n" + //$NON-NLS-1$
- " foo();\n" + //$NON-NLS-1$
- " while(1 < 10);"; //$NON-NLS-1$
- checkSourceRange(doStatement, expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11129
- */
- public void test0303() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0303", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression2 = expressionStatement.getExpression();
- assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$
- Assignment assignment = (Assignment) expression2;
- Expression expression = assignment.getRightHandSide();
-// assertTrue("Not a CastExpression", expression instanceof CastExpression); //$NON-NLS-1$
-// CastExpression castExpression = (CastExpression) expression;
- ITypeBinding typeBinding = expression.resolveTypeBinding();
- assertNotNull("No binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// Type type = castExpression.getType();
-// ITypeBinding typeBinding2 = type.resolveBinding();
-// assertNotNull("No binding2", typeBinding2); //$NON-NLS-1$
-// assertEquals("Wrong name", "char", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11151
- */
- public void test0304() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0304", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- checkSourceRange(node, "function foo(arg);", source); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- assertNull("Has a body", block); //$NON-NLS-1$
- }
-//
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=11125
-// */
-// public void test0305() {
-// char[] source =
-// ("" + //$NON-NLS-1$
-// " function foo(arg) {}\n" + //$NON-NLS-1$
-// "").toCharArray(); //$NON-NLS-1$
-// IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$
-// ASTNode result = runConversion(source, "Test.js", project, true); //$NON-NLS-1$
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0);
-// assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// TypeDeclaration typeDeclaration = (TypeDeclaration) node;
-// ITypeBinding typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-//// assertEquals("Wrong name", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-//// assertEquals("Wrong package", "test0305", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-//// assertTrue("Not an interface", typeBinding.isClass()); //$NON-NLS-1$
-// }
-
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=11125
-// */
-// public void test0306() {
-// char[] source =
-// ("" + //$NON-NLS-1$
-// " function foo(arg) {}\n" + //$NON-NLS-1$
-// "").toCharArray(); //$NON-NLS-1$
-// IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$
-// ASTNode result = runConversion(source, "Object.js", project, true); //$NON-NLS-1$
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0);
-// assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
-// TypeDeclaration typeDeclaration = (TypeDeclaration) node;
-// ITypeBinding typeBinding = typeDeclaration.resolveBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-//// assertEquals("Wrong name", "Object", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-//// assertEquals("Wrong package", "java.lang", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
-//// assertTrue("Not an interface", typeBinding.isClass()); //$NON-NLS-1$
-// assertEquals("Wrong size", 2, typeBinding.getDeclaredMethods().length); //$NON-NLS-1$
-// }
-//
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=11371
-// */
-// public void test0307() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0307", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
-// assertTrue("not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
-// FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
-// Block block = methodDeclaration.getBody();
-// assertNotNull("No body", block); //$NON-NLS-1$
-// List statements = block.statements();
-// assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
-// Statement statement = (Statement) statements.get(0);
-// assertTrue("Not a super constructor invocation", statement instanceof SuperConstructorInvocation); //$NON-NLS-1$
-// checkSourceRange(statement, "super(10);", source);
-// }
-//
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=11371
-// */
-// public void test0308() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0308", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
-// assertTrue("not a method declaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
-// FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
-// Block block = methodDeclaration.getBody();
-// assertNotNull("No body", block); //$NON-NLS-1$
-// List statements = block.statements();
-// assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
-// Statement statement = (Statement) statements.get(0);
-// assertTrue("Not a super constructor invocation", statement instanceof SuperConstructorInvocation); //$NON-NLS-1$
-// SuperConstructorInvocation superConstructorInvocation = (SuperConstructorInvocation) statement;
-// IFunctionBinding methodBinding = superConstructorInvocation.resolveConstructorBinding();
-// assertNotNull("No methodBinding", methodBinding); //$NON-NLS-1$
-// IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding();
-// assertNotNull("No methodBinding2", methodBinding2); //$NON-NLS-1$
-// }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11380
- */
- public void test0309() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0309", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a conditional expression", expression instanceof ConditionalExpression); //$NON-NLS-1$
- ConditionalExpression conditionalExpression = (ConditionalExpression) expression;
- ITypeBinding typeBinding = conditionalExpression.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "Number", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11380
- */
- public void test0310() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0310", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a fieldAccess", expression instanceof FieldAccess); //$NON-NLS-1$
- FieldAccess fieldAccess = (FieldAccess) expression;
- SimpleName qualifier = (SimpleName)fieldAccess.getExpression();
- IBinding binding = qualifier.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong name", "I", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=11638
-// */
-// public void test0311() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0311", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
-// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
-// List fragments = variableDeclarationStatement.fragments();
-// assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
-// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
-// Expression expression = variableDeclarationFragment.getInitializer();
-// assertTrue("not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
-// ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
-// AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
-// assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$
-// List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
-// assertEquals("wrong size for body declarations", 1, bodyDeclarations.size()); //$NON-NLS-1$
-// BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
-// assertTrue("Not a method declaration", bodyDeclaration instanceof FunctionDeclaration); //$NON-NLS-1$
-// FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
-// Block block = methodDeclaration.getBody();
-// assertNotNull("no body", block); //$NON-NLS-1$
-// List statements = block.statements();
-// assertEquals("Wrong size for statements", 1, statements.size()); //$NON-NLS-1$
-// Statement statement = (Statement) statements.get(0);
-// assertTrue("not a variable declaration statement", statement instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement2 = (VariableDeclarationStatement) statement;
-// List fragments2 = variableDeclarationStatement2.fragments();
-// assertEquals("wrong size for fragments2", 1, fragments2.size()); //$NON-NLS-1$
-// VariableDeclarationFragment variableDeclarationFragment2 = (VariableDeclarationFragment) fragments2.get(0);
-// Expression expression2 = variableDeclarationFragment2.getInitializer();
-// assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$
-// Name name = (Name) expression2;
-// checkSourceRange(name, "j", source); //$NON-NLS-1$
-// IBinding binding = name.resolveBinding();
-// ASTNode declaringNode = compilationUnit.findDeclaringNode(binding);
-// assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$
-// checkSourceRange(declaringNode, "var j", source); //$NON-NLS-1$
-// assertTrue("Not a single variable declaration", declaringNode instanceof SingleVariableDeclaration); //$NON-NLS-1$
-// }
-
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=11638
-// * There is a error in this source. A is unresolved. Then there is no
-// * declaring node.
-// */
-// public void test0312() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0312", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
-// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
-// List fragments = variableDeclarationStatement.fragments();
-// assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
-// VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
-// Expression expression = variableDeclarationFragment.getInitializer();
-// assertTrue("not a class instance creation", expression instanceof ClassInstanceCreation); //$NON-NLS-1$
-// ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
-// AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
-// assertNotNull("No body", anonymousClassDeclaration); //$NON-NLS-1$
-// List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
-// assertEquals("wrong size for body declarations", 1, bodyDeclarations.size()); //$NON-NLS-1$
-// BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
-// assertTrue("Not a method declaration", bodyDeclaration instanceof FunctionDeclaration); //$NON-NLS-1$
-// FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
-// Block block = methodDeclaration.getBody();
-// assertNotNull("no body", block); //$NON-NLS-1$
-// List statements = block.statements();
-// assertEquals("Wrong size for statements", 1, statements.size()); //$NON-NLS-1$
-// Statement statement = (Statement) statements.get(0);
-// assertTrue("not a variable declaration statement", statement instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement2 = (VariableDeclarationStatement) statement;
-// List fragments2 = variableDeclarationStatement2.fragments();
-// assertEquals("wrong size for fragments2", 1, fragments2.size()); //$NON-NLS-1$
-// VariableDeclarationFragment variableDeclarationFragment2 = (VariableDeclarationFragment) fragments2.get(0);
-// Expression expression2 = variableDeclarationFragment2.getInitializer();
-// assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$
-// Name name = (Name) expression2;
-// checkSourceRange(name, "j", source); //$NON-NLS-1$
-// IBinding binding = name.resolveBinding();
-// ASTNode declaringNode = compilationUnit.findDeclaringNode(binding);
-// assertNull("No declaring node is available", declaringNode); //$NON-NLS-1$
-// }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11659
- */
- public void test0313() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0313", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an InfixExpression", expression instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "i+j", source); //$NON-NLS-1$
- Expression expression2 = infixExpression.getLeftOperand();
- checkSourceRange(expression2, "i", source); //$NON-NLS-1$
- assertTrue("Not a name", expression2 instanceof Name); //$NON-NLS-1$
- Name name = (Name) expression2;
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- ASTNode astNode = compilationUnit.findDeclaringNode(binding);
- assertNotNull("No declaring node", astNode); //$NON-NLS-1$
- checkSourceRange(astNode, "i", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=12326
- */
- public void test0314() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0314", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("No result", result); //$NON-NLS-1$
- assertTrue("Not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("Wrong line number", 1, compilationUnit.getLineNumber(0)); //$NON-NLS-1$
- // ensure that last character is on the last line
- assertEquals("Wrong line number", 1, compilationUnit.getLineNumber(source.length - 1)); //$NON-NLS-1$
- // source.length is beyond the size of the compilation unit source
- assertEquals("Wrong line number", -1, compilationUnit.getLineNumber(source.length)); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=12326
- */
- public void test0315() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0315", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a Return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("Not an InfixExpression expression", expression instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression instanceOfExpression = (InfixExpression) expression;
- Expression rightOperand = instanceOfExpression.getRightOperand();
- assertTrue("Not a SimpleName", rightOperand instanceof SimpleName); //$NON-NLS-1$
- SimpleName simpleType = (SimpleName) rightOperand;
- assertTrue("wrong operator",instanceOfExpression.getOperator().equals(InfixExpression.Operator.INSTANCEOF));
-// Name n = simpleType.getName();
-// assertTrue("Not a qualified name", n instanceof QualifiedName); //$NON-NLS-1$
-// QualifiedName name = (QualifiedName) n;
- checkSourceRange(simpleType, "String", source); //$NON-NLS-1$
- ITypeBinding typeBinding = simpleType.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "String", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// Name qualifier = name.getQualifier();
-// assertTrue("Not a qualified name", qualifier instanceof QualifiedName); //$NON-NLS-1$
-// ITypeBinding typeBinding2 = qualifier.resolveTypeBinding();
-// assertNull("typebinding2 is not null", typeBinding2); //$NON-NLS-1$
-// IBinding binding = qualifier.resolveBinding();
-// assertNotNull("no binding", binding); //$NON-NLS-1$
-// assertEquals("Wrong type", IBinding.PACKAGE, binding.getKind()); //$NON-NLS-1$
-// IPackageBinding pBinding = (IPackageBinding) binding;
-// assertEquals("Wrong name", "java.io", pBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=12454
-// */
-// public void test0316() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Hello.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No result", result); //$NON-NLS-1$
-// assertTrue("Not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// assertEquals("Wrong size", 1, compilationUnit.getMessages().length); //$NON-NLS-1$
-// assertEquals("Wrong size", 1, compilationUnit.getProblems().length); //$NON-NLS-1$
-// }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=12781
- */
- public void test0317() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0317", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a return statement", node instanceof ReturnStatement); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("not an InfixExpression expression", expression instanceof InfixExpression); //$NON-NLS-1$
- InfixExpression instanceOfExpression = (InfixExpression) expression;
- assertTrue("wrong operator",instanceOfExpression.getOperator().equals(InfixExpression.Operator.INSTANCEOF));
- Expression left = instanceOfExpression.getLeftOperand();
- assertTrue("Not a Name", left instanceof Name); //$NON-NLS-1$
- Name name = (Name) left;
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("wrong name", "x", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding = name.resolveTypeBinding();
- assertNotNull("No typebinding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong type", "any", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Expression right = instanceOfExpression.getRightOperand();
- assertTrue("Not a simpleName", right instanceof SimpleName); //$NON-NLS-1$
- SimpleName simpleType = (SimpleName) right;
- name = simpleType;//.getName();
- assertTrue("Not a simpleName", name instanceof SimpleName); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- IBinding binding2 = simpleName.resolveBinding();
- assertNotNull("No binding2", binding2); //$NON-NLS-1$
- assertEquals("Wrong name", "Boolean", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
- assertNotNull("No typeBinding2", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong name", "Boolean", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13233
- */
- public void test0318() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0318", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("No error", 1, unit.getMessages().length); //$NON-NLS-1$
- assertEquals("No error", 1, unit.getProblems().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0319() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0319", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an array creation", expression instanceof ArrayInitializer); //$NON-NLS-1$
- ArrayInitializer arrayCreation = (ArrayInitializer) expression;
- ITypeBinding typeBinding = arrayCreation.resolveTypeBinding();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "any[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// ArrayType arrayType = arrayCreation.getType();
-// ITypeBinding typeBinding2 = arrayType.resolveBinding();
-// assertNotNull("no type binding2", typeBinding2); //$NON-NLS-1$
-// assertEquals("wrong name", "Object[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// Type type = arrayType.getElementType();
-// assertTrue("Not a simple type", type instanceof SimpleType); //$NON-NLS-1$
-// SimpleType simpleType = (SimpleType) type;
-// ITypeBinding typeBinding3 = simpleType.resolveBinding();
-// assertNotNull("no type binding3", typeBinding3); //$NON-NLS-1$
-// assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
- */
- public void test0320() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0320", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
-
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
-
-
- IVariableBinding binding = variableDeclarationFragment.resolveBinding();
- ITypeBinding typeBinding = binding.getType();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "Number[]", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-
-// Type type = variableDeclarationStatement.getType();
-// checkSourceRange(type, "int[]", source); //$NON-NLS-1$
-// assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
-// ArrayType arrayType = (ArrayType) type;
-// ITypeBinding typeBinding = arrayType.resolveBinding();
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// Type elementType = arrayType.getElementType();
-// assertTrue("Not a simple type", elementType.isPrimitiveType()); //$NON-NLS-1$
-// ITypeBinding typeBinding2 = elementType.resolveBinding();
-// assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$
- }
-
-// /**
-// * http://dev.eclipse.org/bugs/show_bug.cgi?id=13807
-// */
-// public void test0321() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0321", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// char[] source = sourceUnit.getSource().toCharArray();
-// ASTNode result = runConversion(sourceUnit, true);
-// assertNotNull("No compilation unit", result); //$NON-NLS-1$
-// assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
-// assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
-// VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
-// Type type = variableDeclarationStatement.getType();
-// assertTrue("Not an array type", type.isArrayType()); //$NON-NLS-1$
-// ArrayType arrayType = (ArrayType) type;
-// ITypeBinding typeBinding = arrayType.resolveBinding();
-// checkSourceRange(type, "java.lang.Object[][]", source); //$NON-NLS-1$
-// assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
-// Type elementType = arrayType.getComponentType();
-// ITypeBinding typeBinding2 = elementType.resolveBinding();
-// assertNotNull("No type binding2", typeBinding2); //$NON-NLS-1$
-// assertEquals("wrong dimension", 1, typeBinding2.getDimensions()); //$NON-NLS-1$
-// assertEquals("wrong name", "Object[]", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// assertTrue("Not an array type", elementType.isArrayType()); //$NON-NLS-1$
-// Type elementType2 = ((ArrayType) elementType).getComponentType();
-// assertTrue("Not a simple type", elementType2.isSimpleType()); //$NON-NLS-1$
-// ITypeBinding typeBinding3 = elementType2.resolveBinding();
-// assertNotNull("No type binding3", typeBinding3); //$NON-NLS-1$
-// assertEquals("wrong dimension", 0, typeBinding3.getDimensions()); //$NON-NLS-1$
-// assertEquals("wrong name", "Object", typeBinding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
-// }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=13231
- */
- public void test0322() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0322", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertTrue("Not a VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a null literal", expression instanceof NullLiteral); //$NON-NLS-1$
- NullLiteral nullLiteral = (NullLiteral) expression;
- ITypeBinding typeBinding = nullLiteral.resolveTypeBinding();
- assertNotNull("no type binding", typeBinding); //$NON-NLS-1$
- assertTrue("Not the null type", typeBinding.isNullType()); //$NON-NLS-1$
- assertEquals("Wrong qualified name", typeBinding.getQualifiedName(), "null"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14198
- */
- public void test0323() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0323", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression2 = expressionStatement.getExpression();
- assertTrue("Not an Assignement", expression2 instanceof Assignment); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14217
- */
- public void test0326() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0326", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- char[] source = sourceUnit.getSource().toCharArray();
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertTrue("Not an ExpressionStatement", node instanceof ExpressionStatement); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- checkSourceRange(expressionStatement.getExpression(), "a().f= a()", source); //$NON-NLS-1$
- checkSourceRange(expressionStatement, "a().f= a();", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14322
- */
- public void test0331() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0331", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertTrue("Not an VariableDeclarationStatement", node instanceof VariableDeclarationStatement); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a QualifiedName", expression instanceof QualifiedName); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) expression;
- IBinding binding = qualifiedName.getName().resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind()); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertTrue("Not a field", variableBinding.isField()); //$NON-NLS-1$
- assertNull("Got a declaring class", variableBinding.getDeclaringClass()); //$NON-NLS-1$
- assertEquals("wrong name", "length", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=15061
- */
- public void test0339() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0339", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No errors found", 3, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a Type declaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("wrong size", 1, bodyDeclarations.size()); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclarations.get(0);
- checkSourceRange(methodDeclaration, "function doQuery(boolean x);", source); //$NON-NLS-1$
- node = getASTNode(compilationUnit, 0, 1);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a FunctionDeclaration", node instanceof FunctionDeclaration); //$NON-NLS-1$
- String expectedSource =
- "function setX( x) {\n" + //$NON-NLS-1$
- " {\n" + //$NON-NLS-1$
- " z\n" + //$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- int methodEndPosition = node.getStartPosition() + node.getLength();
- node = getASTNode(compilationUnit, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- int typeEndPosition = node.getStartPosition() + node.getLength();
- assertEquals("different positions", methodEndPosition, typeEndPosition); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=14852
- */
- public void test0340() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "p3", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not an method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertNotNull("No receiver", expression2); //$NON-NLS-1$
- ITypeBinding binding = expression2.resolveTypeBinding();
- assertNotNull("No type binding", binding); //$NON-NLS-1$
- assertEquals("wrong name", "A", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong name", "p2", binding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Not a qualified name", expression2.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) expression2;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("wrong name", "A", simpleName.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding = simpleName.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "A", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong name", "p2", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- Name name = qualifiedName.getQualifier();
- assertTrue("Not a simple name", name.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName2 = (SimpleName) name;
- assertEquals("wrong name", "p2", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("No binding", binding2); //$NON-NLS-1$
- assertEquals("wrong type", IBinding.PACKAGE, binding2.getKind()); //$NON-NLS-1$
- assertEquals("wrong name", "p2", binding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- node = getASTNode(compilationUnit, 0, 1, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement2 = (ExpressionStatement) node;
- Expression expression3 = expressionStatement2.getExpression();
- assertTrue("Not an method invocation", expression3.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation2 = (FunctionInvocation) expression3;
- Expression expression4 = methodInvocation2.getExpression();
- assertNotNull("No receiver", expression4); //$NON-NLS-1$
- ITypeBinding binding3 = expression4.resolveTypeBinding();
- assertNotNull("No type binding", binding3); //$NON-NLS-1$
- assertEquals("wrong name", "A", binding3.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("wrong name", "p1", binding3.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=15804
- */
- public void test0341() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0341", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- String expectedSource =
- "if (field != null) {\n" + //$NON-NLS-1$
- " throw new IOException();\n" + //$NON-NLS-1$
- " } else if (field == null) {\n" + //$NON-NLS-1$
- " throw new MalformedURLException();\n" + //$NON-NLS-1$
- " } else if (field == null) {\n" + //$NON-NLS-1$
- " throw new InterruptedIOException();\n" + //$NON-NLS-1$
- " } else {\n" + //$NON-NLS-1$
- " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- IfStatement ifStatement = (IfStatement) node;
- Statement thenStatement = ifStatement.getThenStatement();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " throw new IOException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(thenStatement, expectedSource, source);
- Statement elseStatement = ifStatement.getElseStatement();
- expectedSource =
- "if (field == null) {\n" + //$NON-NLS-1$
- " throw new MalformedURLException();\n" + //$NON-NLS-1$
- " } else if (field == null) {\n" + //$NON-NLS-1$
- " throw new InterruptedIOException();\n" + //$NON-NLS-1$
- " } else {\n" + //$NON-NLS-1$
- " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(elseStatement, expectedSource, source);
- assertTrue("Not a if statement", elseStatement.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- ifStatement = (IfStatement) elseStatement;
- thenStatement = ifStatement.getThenStatement();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " throw new MalformedURLException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(thenStatement, expectedSource, source);
- elseStatement = ifStatement.getElseStatement();
- expectedSource =
- "if (field == null) {\n" + //$NON-NLS-1$
- " throw new InterruptedIOException();\n" + //$NON-NLS-1$
- " } else {\n" + //$NON-NLS-1$
- " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(elseStatement, expectedSource, source);
- assertTrue("Not a if statement", elseStatement.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- ifStatement = (IfStatement) elseStatement;
- thenStatement = ifStatement.getThenStatement();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " throw new InterruptedIOException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(thenStatement, expectedSource, source);
- elseStatement = ifStatement.getElseStatement();
- expectedSource =
- "{\n" + //$NON-NLS-1$
- " throw new UnsupportedEncodingException();\n" + //$NON-NLS-1$
- " }"; //$NON-NLS-1$
- checkSourceRange(elseStatement, expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=16051
- */
- public void test0343() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0343", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 1);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- String expectedSource =
- "if (flag)\n" + //$NON-NLS-1$
- " i= 10;"; //$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=17922
- */
- public void test0345() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0345", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not an ArrayCreation", expression.getNodeType() == ASTNode.ARRAY_CREATION); //$NON-NLS-1$
- ArrayCreation arrayCreation = (ArrayCreation) expression;
- ArrayType arrayType = arrayCreation.getType();
- IBinding binding2 = arrayType.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertEquals("not a type", binding2.getKind(), IBinding.TYPE); //$NON-NLS-1$
- ITypeBinding typeBinding2 = (ITypeBinding) binding2;
- assertTrue("Not an array type binding2", typeBinding2.isArray()); //$NON-NLS-1$
- Type type = arrayType.getElementType();
- assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("QualifiedName", name.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$
- SimpleName simpleName = ((QualifiedName) name).getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("no binding", binding); //$NON-NLS-1$
- assertEquals("not a type", binding.getKind(), IBinding.TYPE); //$NON-NLS-1$
- ITypeBinding typeBinding = (ITypeBinding) binding;
- assertTrue("An array type binding", !typeBinding.isArray()); //$NON-NLS-1$
- Type type2 = fieldDeclaration.getType();
- assertTrue("Not a array type", type2.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType2 = (ArrayType) type2;
- Type type3 = arrayType2.getElementType();
- assertTrue("Not a simple type", type3.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType2 = (SimpleType) type3;
- Name name2 = simpleType2.getName();
- assertTrue("Not a qualified name", name2.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$
- SimpleName simpleName2 = ((QualifiedName) name2).getName();
- IBinding binding3 = simpleName2.resolveBinding();
- assertNotNull("no binding", binding3); //$NON-NLS-1$
- assertEquals("not a type", binding3.getKind(), IBinding.TYPE); //$NON-NLS-1$
- ITypeBinding typeBinding3 = (ITypeBinding) binding3;
- assertTrue("An array type binding", !typeBinding3.isArray()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0346() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0346", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "Vector", source); //$NON-NLS-1$
- assertTrue("not an array type", !type.isArrayType()); //$NON-NLS-1$
- assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("Not a simpleName", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- ITypeBinding typeBinding = (ITypeBinding) binding;
- assertTrue("An array", !typeBinding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- ITypeBinding typeBinding2 = simpleType.resolveBinding();
- assertNotNull("No binding", typeBinding2); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, typeBinding2.getKind()); //$NON-NLS-1$
- assertTrue("An array", !typeBinding2.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector", typeBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0347() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0347", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "Vector[]", source); //$NON-NLS-1$
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding binding = arrayType.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector[]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0348() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0348", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "Vector[][]", source); //$NON-NLS-1$
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding binding = arrayType.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector[][]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0349() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0349", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Vector[][]", source); //$NON-NLS-1$
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- ITypeBinding binding = arrayType.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("Not an array type", binding.isArray()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector[][]", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18138
- */
- public void test0350() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0350", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- VariableDeclarationStatement fieldDeclaration = (VariableDeclarationStatement) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Vector", source); //$NON-NLS-1$
- assertTrue("not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- ITypeBinding binding = simpleType.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("An array type", binding.isClass()); //$NON-NLS-1$
- assertEquals("Wrong name", "Vector", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18169
- */
- public void test0351() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0351", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(singleVariableDeclaration, "var a", source); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1);
- checkSourceRange(singleVariableDeclaration, "var b", source); //$NON-NLS-1$
- node = getASTNode(compilationUnit, 0, 1);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(singleVariableDeclaration, "var a", source); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1);
- checkSourceRange(singleVariableDeclaration, "var b", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18169
- */
- public void test0352() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0352", "Test2.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- SingleVariableDeclaration singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(singleVariableDeclaration, "var a", source); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1);
- checkSourceRange(singleVariableDeclaration, "var b", source); //$NON-NLS-1$
- node = getASTNode(compilationUnit, 0, 1);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- parameters = methodDeclaration.parameters();
- assertEquals("wrong size", 2, parameters.size()); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(singleVariableDeclaration, "vara", source); //$NON-NLS-1$
- singleVariableDeclaration = (SingleVariableDeclaration) parameters.get(1);
- checkSourceRange(singleVariableDeclaration, "var b", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=18042
- */
- public void test0353() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0353", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("not null", node); //$NON-NLS-1$
- assertTrue("Not an variable declaration", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- checkSourceRange(type, "InputStream", source); //$NON-NLS-1$
- assertTrue("not a simple type", type.isSimpleType()); //$NON-NLS-1$
- ITypeBinding binding = type.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind()); //$NON-NLS-1$
- assertTrue("Not a class", binding.isClass()); //$NON-NLS-1$
- assertEquals("Wrong name", "InputStream", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong package", "java.io", binding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- IBinding binding2 = name.resolveBinding();
- assertNotNull("No binding", binding2); //$NON-NLS-1$
- assertEquals("Wrong type", IBinding.TYPE, binding2.getKind()); //$NON-NLS-1$
- ITypeBinding typeBinding = (ITypeBinding) binding2;
- assertTrue("Not a class", typeBinding.isClass()); //$NON-NLS-1$
- assertEquals("Wrong name", "InputStream", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong package", "java.io", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=19851
- */
- public void test0354() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0354", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 2, compilationUnit.getMessages().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=20520
- */
- public void test0355() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0355", "Foo.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not an if statement", node.getNodeType() == ASTNode.IF_STATEMENT); //$NON-NLS-1$
- IfStatement ifStatement = (IfStatement) node;
- Expression condition = ifStatement.getExpression();
- assertTrue("Not an infixExpression", condition.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) condition;
- Expression expression = infixExpression.getLeftOperand();
- assertTrue("Not a method invocation expression", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a parenthesis expression", expression2.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=20865
- */
- public void test0356() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0356", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 1, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- Type type = variableDeclarationStatement.getType();
- ITypeBinding binding = type.resolveBinding();
- assertNotNull("Binding should NOT be null for type: "+type, binding);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21757
- */
- public void test0357() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0357", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration statement", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- SimpleName name = typeDeclaration.getName();
- checkSourceRange(name, "A", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21768
- */
- public void test0358() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0358", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0,0);
- assertNotNull(node);
- assertTrue("Not a method declaration statement", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- SimpleName name = methodDeclaration.getName();
- checkSourceRange(name, "mdd", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21768
- */
- public void test0359() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0359", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0,0);
- assertNotNull(node);
- assertTrue("Not a method declaration statement", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- SimpleName name = methodDeclaration.getName();
- checkSourceRange(name, "mdd", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916
- */
- public void test0360() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0360", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0,0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- List initializers = forStatement.initializers();
- assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916
- */
- public void test0361() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0361", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0,0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- List initializers = forStatement.initializers();
- assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=21916
- * @deprecated using deprecated code
- */
- public void test0362() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0362", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- ForStatement forStatement = this.ast.newForStatement();
-
- VariableDeclarationFragment iFragment = this.ast.newVariableDeclarationFragment();
- iFragment.setName(this.ast.newSimpleName("i")); //$NON-NLS-1$
- iFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- VariableDeclarationFragment jFragment = this.ast.newVariableDeclarationFragment();
- jFragment.setName(this.ast.newSimpleName("j")); //$NON-NLS-1$
- jFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
- VariableDeclarationFragment kFragment = this.ast.newVariableDeclarationFragment();
- kFragment.setName(this.ast.newSimpleName("k")); //$NON-NLS-1$
- kFragment.setInitializer(this.ast.newNumberLiteral("0"));//$NON-NLS-1$
-
- VariableDeclarationExpression variableDeclarationExpression = this.ast.newVariableDeclarationExpression(iFragment);
- variableDeclarationExpression.setModifiers(Modifier.NONE);
-// variableDeclarationExpression.setType(this.ast.newPrimitiveType(PrimitiveType.INT));
- variableDeclarationExpression.fragments().add(jFragment);
- variableDeclarationExpression.fragments().add(kFragment);
- forStatement.initializers().add(variableDeclarationExpression);
-
- PostfixExpression iPostfixExpression = this.ast.newPostfixExpression();
- iPostfixExpression.setOperand(this.ast.newSimpleName("i"));//$NON-NLS-1$
- iPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(iPostfixExpression);
-
- PostfixExpression jPostfixExpression = this.ast.newPostfixExpression();
- jPostfixExpression.setOperand(this.ast.newSimpleName("j"));//$NON-NLS-1$
- jPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(jPostfixExpression);
-
- PostfixExpression kPostfixExpression = this.ast.newPostfixExpression();
- kPostfixExpression.setOperand(this.ast.newSimpleName("k"));//$NON-NLS-1$
- kPostfixExpression.setOperator(PostfixExpression.Operator.INCREMENT);
- forStatement.updaters().add(kPostfixExpression);
-
- forStatement.setBody(this.ast.newBlock());
-
- InfixExpression infixExpression = this.ast.newInfixExpression();
- infixExpression.setLeftOperand(this.ast.newSimpleName("i")); //$NON-NLS-1$
- infixExpression.setOperator(InfixExpression.Operator.LESS);
- infixExpression.setRightOperand(this.ast.newNumberLiteral("10")); //$NON-NLS-1$
- forStatement.setExpression(infixExpression);
-
- assertTrue("Both AST trees should be identical", forStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- checkSourceRange(node, "for (var i=0, j=0, k=0; i<10 ; i++, j++, k++) {}", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22939
- */
- public void test0363() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0363", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 1);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = variableDeclarationFragment.getInitializer();
- assertTrue("Not a parenthesized expression", expression.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$
- Expression expression2 = ((ParenthesizedExpression) expression).getExpression();
- checkSourceRange(expression2, "xxxx", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11529
- */
- public void test0364() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0364", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- checkSourceRange(variableDeclarationStatement, "var local;", source); //$NON-NLS-1$
- SimpleName simpleName = variableDeclarationFragment.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=11529
- */
- public void test0365() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0365", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- List initializers = forStatement.initializers();
- assertEquals("Wrong size", 1, initializers.size()); //$NON-NLS-1$
- VariableDeclarationExpression variableDeclarationExpression = (VariableDeclarationExpression) initializers.get(0);
- List fragments = variableDeclarationExpression.fragments();
- assertEquals("Wrong size", 1, fragments.size()); //$NON-NLS-1$
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) fragments.get(0);
- SimpleName simpleName = variableDeclarationFragment.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0366() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0366", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- checkSourceRange(forStatement, "for (var i = 0; i < 5; ++i);", source); //$NON-NLS-1$
- Statement statement = forStatement.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0367() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0367", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("errors found", 0, compilationUnit.getMessages().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a while statement", node.getNodeType() == ASTNode.WHILE_STATEMENT); //$NON-NLS-1$
- WhileStatement whileStatement = (WhileStatement) node;
- checkSourceRange(whileStatement, "while(i == 2);", source); //$NON-NLS-1$
- Statement statement = whileStatement.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0368() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0368", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 1, "The label test is never explicitly referenced"); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.LABELED_STATEMENT); //$NON-NLS-1$
- LabeledStatement labeledStatement = (LabeledStatement) node;
- checkSourceRange(labeledStatement, "test:;", source); //$NON-NLS-1$
- Statement statement = labeledStatement.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23048
- */
- public void test0369() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0369", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 1, "The label test is never explicitly referenced"); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a labeled statement", node.getNodeType() == ASTNode.LABELED_STATEMENT); //$NON-NLS-1$
- LabeledStatement labeledStatement = (LabeledStatement) node;
- checkSourceRange(labeledStatement, "test:\\u003B", source); //$NON-NLS-1$
- Statement statement = labeledStatement.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, "\\u003B", source); //$NON-NLS-1$
- }
-
- /**
- * DoStatement ==> DoStatement
- */
- public void test0370() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0370", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull("Expression should not be null", node); //$NON-NLS-1$
- DoStatement doStatement = this.ast.newDoStatement();
- doStatement.setBody(this.ast.newEmptyStatement());
- doStatement.setExpression(this.ast.newBooleanLiteral(true));
- assertTrue("Both AST trees should be identical", doStatement.subtreeMatch(new ASTMatcher(), node)); //$NON-NLS-1$
- String expectedSource = "do ; while(true);";//$NON-NLS-1$
- checkSourceRange(node, expectedSource, source);
- DoStatement doStatement2 = (DoStatement) node;
- Statement statement = doStatement2.getBody();
- assertTrue("Not an empty statement", statement.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- checkSourceRange(statement, ";", source); //$NON-NLS-1$
- }
-}
-
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTest2.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTest2.java
deleted file mode 100644
index 69fd0b4..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTest2.java
+++ /dev/null
@@ -1,5418 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.io.IOException;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.wst.jsdt.core.*;
-import org.eclipse.wst.jsdt.core.compiler.IProblem;
-import org.eclipse.wst.jsdt.core.dom.*;
-import org.eclipse.wst.jsdt.core.tests.model.CancelCounter;
-import org.eclipse.wst.jsdt.core.tests.model.Canceler;
-import org.eclipse.wst.jsdt.core.tests.model.ReconcilerTests;
-import org.eclipse.wst.jsdt.core.tests.util.Util;
-
-public class ASTConverterTest2 extends ConverterTestSetup {
-
- /** @deprecated using deprecated code */
- public void setUpSuite() throws Exception {
- super.setUpSuite();
- this.ast = AST.newAST(AST.JLS2);
- }
-
- public ASTConverterTest2(String name) {
- super(name);
- }
-
- static {
-// TESTS_NAMES = new String[] {"test0578"};
-// TESTS_NUMBERS = new int[] { 606 };
- }
- public static Test suite() {
- return buildModelTestSuite(ASTConverterTest2.class);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22560
- * @deprecated using deprecated code
- */
- public void test0401() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0401", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not a return statement", statement.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) statement;
- Expression expression = returnStatement.getExpression();
- assertNotNull("there is no expression", expression); //$NON-NLS-1$
- // call the default initialization
- methodDeclaration.getReturnType();
- ITypeBinding typeBinding = expression.resolveTypeBinding();
- assertNotNull("No typebinding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23464
- */
- public void test0402() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0402", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 0);
- assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not a super method invocation", node.getNodeType() == ASTNode.SUPER_CONSTRUCTOR_INVOCATION); //$NON-NLS-1$
- checkSourceRange(node, "new A().super();", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597
- */
- public void test0403() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0403", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 1);
- assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "test", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IFunctionBinding methodBinding = (IFunctionBinding) binding2;
- assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IFunctionBinding methodBinding2 = methodInvocation.resolveMethodBinding();
- assertNotNull("No method binding2", methodBinding2);
- assertTrue("Wrong binding", methodBinding == methodBinding2);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597
- */
- public void test0404() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0404", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IFunctionBinding methodBinding = (IFunctionBinding) binding2;
- assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597
- */
- public void test0405() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0405", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 1);
- assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IFunctionBinding methodBinding = (IFunctionBinding) binding2;
- assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597
- */
- public void test0406() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0406", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "foo", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IFunctionBinding methodBinding = (IFunctionBinding) binding2;
- assertEquals("Wrong name", "foo", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertNull("Got a declaring node in the unit", unit.findDeclaringNode(methodBinding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162
- */
- public void test0407() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0407", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- SimpleName simpleName = methodDeclaration.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("Not a method binding", binding.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IFunctionBinding methodBinding = (IFunctionBinding) binding;
- assertEquals("wrong name", "foo", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- methodDeclaration.setName(methodDeclaration.getAST().newSimpleName("foo2")); //$NON-NLS-1$
- IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding();
- assertNotNull("No methodbinding2", methodBinding2); //$NON-NLS-1$
- assertEquals("wrong name", "foo", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- simpleName = methodDeclaration.getName();
- IBinding binding2 = simpleName.resolveBinding();
- assertNull("Got a binding2", binding2); //$NON-NLS-1$
-
- ASTNode astNode = unit.findDeclaringNode(methodBinding);
- assertNotNull("No declaring node", astNode);
- assertEquals("wrong declaring node", methodDeclaration, astNode);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162
- * @deprecated using deprecated code
- */
- public void test0408() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0408", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Type type = methodDeclaration.getReturnType();
- assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("Not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) name;
- name = qualifiedName.getQualifier();
- assertTrue("Not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- qualifiedName = (QualifiedName) name;
- name = qualifiedName.getQualifier();
- assertTrue("Not a simple name", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("Not a package binding", binding.getKind() == IBinding.PACKAGE); //$NON-NLS-1$
- assertEquals("Wrong name", "java", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162
- */
- public void test0409() throws JavaScriptModelException {
- Hashtable options = JavaScriptCore.getOptions();
- Hashtable newOptions = JavaScriptCore.getOptions();
- try {
- newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- JavaScriptCore.setOptions(newOptions);
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0409", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- BindingsCollectorVisitor bindingsCollectorVisitor = new BindingsCollectorVisitor();
- compilationUnit.accept(bindingsCollectorVisitor);
- assertEquals("wrong number", 3, bindingsCollectorVisitor.getUnresolvedNodesSet().size()); //$NON-NLS-1$
- Map bindingsMap = bindingsCollectorVisitor.getBindingsMap();
- assertEquals("wrong number", 205, bindingsMap.size()); //$NON-NLS-1$
- ASTNodesCollectorVisitor nodesCollector = new ASTNodesCollectorVisitor();
- compilationUnit.accept(nodesCollector);
- Set detachedNodes = nodesCollector.getDetachedAstNodes();
- int counter = 0;
- for (Iterator iterator = detachedNodes.iterator(); iterator.hasNext(); ) {
- ASTNode detachedNode = (ASTNode) iterator.next();
- counter++;
- IBinding binding = (IBinding) bindingsMap.get(detachedNode);
- assertNotNull(binding);
- switch(detachedNode.getNodeType()) {
- case ASTNode.ARRAY_ACCESS :
- case ASTNode.ARRAY_CREATION :
- case ASTNode.ARRAY_INITIALIZER :
- case ASTNode.ASSIGNMENT :
- case ASTNode.BOOLEAN_LITERAL :
- case ASTNode.CHARACTER_LITERAL :
- case ASTNode.CLASS_INSTANCE_CREATION :
- case ASTNode.CONDITIONAL_EXPRESSION :
- case ASTNode.FIELD_ACCESS :
- case ASTNode.INFIX_EXPRESSION :
- case ASTNode.INSTANCEOF_EXPRESSION :
- case ASTNode.FUNCTION_INVOCATION :
- case ASTNode.NULL_LITERAL :
- case ASTNode.NUMBER_LITERAL :
- case ASTNode.POSTFIX_EXPRESSION :
- case ASTNode.PREFIX_EXPRESSION :
- case ASTNode.THIS_EXPRESSION :
- case ASTNode.TYPE_LITERAL :
- case ASTNode.VARIABLE_DECLARATION_EXPRESSION :
- ITypeBinding typeBinding = ((Expression) detachedNode).resolveTypeBinding();
- if (!binding.equals(typeBinding)) {
- System.out.println(detachedNode);
- }
- assertTrue("binding not equals", binding.equals(typeBinding)); //$NON-NLS-1$
- break;
- case ASTNode.VARIABLE_DECLARATION_FRAGMENT :
- assertTrue("binding not equals", binding.equals(((VariableDeclarationFragment) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.ANONYMOUS_CLASS_DECLARATION :
- assertTrue("binding not equals", binding.equals(((AnonymousClassDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.QUALIFIED_NAME :
- case ASTNode.SIMPLE_NAME :
- IBinding newBinding = ((Name) detachedNode).resolveBinding();
- assertTrue("binding not equals", binding.equals(newBinding)); //$NON-NLS-1$
- break;
- case ASTNode.ARRAY_TYPE :
- case ASTNode.SIMPLE_TYPE :
- case ASTNode.PRIMITIVE_TYPE :
- assertTrue("binding not equals", binding.equals(((Type) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.CONSTRUCTOR_INVOCATION :
- assertTrue("binding not equals", binding.equals(((ConstructorInvocation) detachedNode).resolveConstructorBinding())); //$NON-NLS-1$
- break;
- case ASTNode.IMPORT_DECLARATION :
- assertTrue("binding not equals", binding.equals(((ImportDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.FUNCTION_DECLARATION :
- assertTrue("binding not equals", binding.equals(((FunctionDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.PACKAGE_DECLARATION :
- assertTrue("binding not equals", binding.equals(((PackageDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.TYPE_DECLARATION :
- assertTrue("binding not equals", binding.equals(((TypeDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- }
- }
- } finally {
- JavaScriptCore.setOptions(options);
- }
- }
-
- /**
- * Test for message on jdt-core-dev
- */
- public void test0410() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0410", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- Expression expression = ((ReturnStatement) node).getExpression();
- assertTrue("Not an infix expression", expression.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expression;
- List extendedOperands = infixExpression.extendedOperands();
- assertEquals("wrong size", 3, extendedOperands.size()); //$NON-NLS-1$
- }
-
- /**
- * Test for message on jdt-core-dev
- */
- public void test0411() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0411", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- Expression expression = ((ReturnStatement) node).getExpression();
- assertTrue("Not an infix expression", expression.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expression;
- List extendedOperands = infixExpression.extendedOperands();
- assertEquals("wrong size", 0, extendedOperands.size()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23901
- */
- public void test0412() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0412", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertNotNull("No declaring node", unit.findDeclaringNode(typeBinding)); //$NON-NLS-1$
- Name name = typeDeclaration.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- ASTNode declaringNode = unit.findDeclaringNode(binding);
- assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$
- assertEquals("Wrong node", typeDeclaration, declaringNode); //$NON-NLS-1$
- typeBinding = name.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- declaringNode = unit.findDeclaringNode(typeBinding);
- assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$
- assertEquals("Wrong node", typeDeclaration, declaringNode); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=20881
- */
- public void test0413() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0413", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 1, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List throwsException = methodDeclaration.thrownExceptions();
- assertEquals("wrong size", 2, throwsException.size()); //$NON-NLS-1$
- Name name = (Name) throwsException.get(0);
- IBinding binding = name.resolveBinding();
- assertNull("Got a binding", binding); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23734
- * @deprecated using deprecated code
- */
- public void test0414() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0414", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Type type = methodDeclaration.getReturnType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- ASTNode declaringNode = unit.findDeclaringNode(typeBinding);
- assertNull("Got a declaring node", declaringNode); //$NON-NLS-1$
-
- node = getASTNode(unit, 0, 1);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration2 = (FunctionDeclaration) node;
- Type type2 = methodDeclaration2.getReturnType();
- ITypeBinding typeBinding2 = type2.resolveBinding();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- ASTNode declaringNode2 = unit.findDeclaringNode(typeBinding2);
- assertNotNull("No declaring node", declaringNode2); //$NON-NLS-1$
-
- IJavaScriptUnit sourceUnit2 = getCompilationUnit("Converter" , "src", "test0414", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- result = runConversion(sourceUnit2, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit2 = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit2.getProblems().length); //$NON-NLS-1$
- ASTNode declaringNode3 = unit2.findDeclaringNode(typeBinding);
- assertNull("Got a declaring node", declaringNode3); //$NON-NLS-1$
-
- ASTNode declaringNode4 = unit2.findDeclaringNode(typeBinding.getKey());
- assertNotNull("No declaring node", declaringNode4); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24268
- */
- public void test0415() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0415", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a switch statement", node.getNodeType() == ASTNode.SWITCH_STATEMENT); //$NON-NLS-1$
- SwitchStatement switchStatement = (SwitchStatement) node;
- List statements = switchStatement.statements();
- assertEquals("wrong size", statements.size(), 5); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(3);
- assertTrue("not a switch case (default)", statement.getNodeType() == ASTNode.SWITCH_CASE); //$NON-NLS-1$
- SwitchCase defaultCase = (SwitchCase) statement;
- assertTrue("not a default case", defaultCase.isDefault());
- checkSourceRange(defaultCase, "default:", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24324
- */
- public void test0416() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0416", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", fragments.size(), 1);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression init = fragment.getInitializer();
- assertTrue("not a qualified name", init.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) init;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("Wrong name", "CONST", simpleName.getIdentifier());
- IBinding binding = simpleName.resolveBinding();
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind());
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong modifier", variableBinding.getModifiers(), Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL);
- ASTNode declaringNode = unit.findDeclaringNode(variableBinding);
- assertNotNull("No declaring node", declaringNode);
- assertTrue("not a variable declaration fragment", declaringNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT);
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) declaringNode;
- FieldDeclaration fieldDeclaration = (FieldDeclaration) variableDeclarationFragment.getParent();
- assertEquals("Wrong modifier", fieldDeclaration.getModifiers(), Modifier.NONE);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24347
- */
- public void test0417() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0417", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertTrue("not a simple type", type.getNodeType() == ASTNode.SIMPLE_TYPE); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("Not a qualified name", name.isQualifiedName());
- QualifiedName qualifiedName = (QualifiedName) name;
- Name qualifier = qualifiedName.getQualifier();
- assertTrue("Not a simple name", qualifier.isSimpleName());
- IBinding binding = qualifier.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24406
- */
- public void test0418() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0418", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 1, 0);
- assertNotNull("No node", node);
- assertTrue("not an expression statement ", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("not an method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Name name = methodInvocation.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0419() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0419", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT);
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a name", expression2.getNodeType(), ASTNode.SIMPLE_NAME);
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNull(binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0420() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0420", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getRightOperand();
- assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION);
- checkSourceRange(expression2, "(2 + 3)", source);
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2;
- Expression expression3 = parenthesizedExpression.getExpression();
- checkSourceRange(expression3, "2 + 3", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0421() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0421", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "(1 + 2) + 3", source);
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION);
- checkSourceRange(expression2, "(1 + 2)", source);
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2;
- Expression expression3 = parenthesizedExpression.getExpression();
- checkSourceRange(expression3, "1 + 2", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0422() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0422", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "( 1 + 2 ) + 3", source);
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION);
- checkSourceRange(expression2, "( 1 + 2 )", source);
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2;
- Expression expression3 = parenthesizedExpression.getExpression();
- checkSourceRange(expression3, "1 + 2", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0423() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0423", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getRightOperand();
- assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION);
- checkSourceRange(expression2, "( 2 + 3 )", source);
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2;
- Expression expression3 = parenthesizedExpression.getExpression();
- checkSourceRange(expression3, "2 + 3", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0424() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0424", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- assertEquals("Wrong size", 1, infixExpression.extendedOperands().size());
- Expression expression2 = (Expression) infixExpression.extendedOperands().get(0);
- checkSourceRange(expression2, "( 2 + 3 )", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0425() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0425", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- assertEquals("Wrong size", 0, infixExpression.extendedOperands().size());
- Expression expression2 = infixExpression.getRightOperand();
- assertTrue("not an infix expression", expression2.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression2 = (InfixExpression) expression2;
- Expression expression3 = infixExpression2.getRightOperand();
- assertTrue("not a parenthesized expression", expression3.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$
- checkSourceRange(expression3, "( 2 + 3 )", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0426() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0426", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertTrue("not a simple type", type.getNodeType() == ASTNode.SIMPLE_TYPE);
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertNotNull("No name", name);
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0427() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0427", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT);
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a super field access", expression2.getNodeType(), ASTNode.SUPER_FIELD_ACCESS);
- SuperFieldAccess superFieldAccess = (SuperFieldAccess) expression2;
- Name name = superFieldAccess.getName();
- assertNotNull("No name", name);
- IBinding binding = name.resolveBinding();
- assertNull("Got a binding", binding);
- assertNull("Got a binding", superFieldAccess.resolveFieldBinding());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0428() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0428", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT);
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a qualified name", expression2.getNodeType(), ASTNode.QUALIFIED_NAME);
- QualifiedName name = (QualifiedName) expression2;
- SimpleName simpleName = name.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- IBinding binding2 = name.resolveBinding();
- assertNotNull("No binding2", binding2);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0429() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0429", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT);
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a qualified name", expression2.getNodeType(), ASTNode.QUALIFIED_NAME);
- QualifiedName name = (QualifiedName) expression2;
- SimpleName simpleName = name.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- IBinding binding2 = name.resolveBinding();
- assertNotNull("No binding2", binding2);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24499
- */
- public void test0430() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0430", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertTrue("Not a constructor invocation", node.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION);
- ConstructorInvocation constructorInvocation = (ConstructorInvocation) node;
- checkSourceRange(constructorInvocation, "this(coo2());", source);
- List arguments = constructorInvocation.arguments();
- assertEquals("Wrong size", 1, arguments.size());
- Expression expression = (Expression) arguments.get(0);
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION);
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- SimpleName simpleName = methodInvocation.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24500
- */
- public void test0431() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0431", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertTrue("Not a constructor invocation", node.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION);
- ConstructorInvocation constructorInvocation = (ConstructorInvocation) node;
- List arguments = constructorInvocation.arguments();
- assertEquals("Wrong size", 1, arguments.size());
- Expression expression = (Expression) arguments.get(0);
- assertTrue("Not a simple name", expression.getNodeType() == ASTNode.SIMPLE_NAME);
- SimpleName simpleName = (SimpleName) expression;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501
- */
- public void test0432() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0432", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType());
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, expression2.getNodeType());
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501
- */
- public void test0433() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0433", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType());
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a super field access", ASTNode.SUPER_FIELD_ACCESS, expression2.getNodeType());
- SuperFieldAccess superFieldAccess = (SuperFieldAccess) expression2;
- SimpleName simpleName = superFieldAccess.getName();
- assertEquals("wrong name", "fCoo", simpleName.getIdentifier());
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong binding", IBinding.VARIABLE, binding.getKind());
- IVariableBinding variableBinding = superFieldAccess.resolveFieldBinding();
- assertTrue("Different binding", binding == variableBinding);
- ASTNode astNode = unit.findDeclaringNode(variableBinding);
- assertTrue("Wrong type", astNode.getNodeType() == ASTNode.SINGLE_VARIABLE_DECLARATION || astNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT || astNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_EXPRESSION);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501
- */
- public void test0434() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0434", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType());
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression2.getNodeType());
- QualifiedName qualifiedName = (QualifiedName) expression2;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("wrong name", "fCoo", simpleName.getIdentifier());
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501
- */
- public void test0435() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0435", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType());
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression2.getNodeType());
- QualifiedName qualifiedName = (QualifiedName) expression2;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("wrong name", "fCoo", simpleName.getIdentifier());
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502
- */
- public void test0436() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0436", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertProblemsSize(unit, 1, "The type A.CInner is not visible"); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType());
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, name.getNodeType());
- QualifiedName qualifiedName = (QualifiedName) name;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("wrong name", "CInner", simpleName.getIdentifier());
- IBinding binding2 = simpleName.resolveBinding();
- assertNotNull("No binding", binding2);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502
- */
- public void test0437() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0437", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertProblemsSize(unit, 1, "The type CInner is not visible"); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType());
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType());
- SimpleName simpleName = (SimpleName) name;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24511
- */
- public void test0438() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0438", "D.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- List imports = unit.imports();
- assertEquals("Wrong size", 1, imports.size()); //$NON-NLS-1$<
- ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0);
- IBinding binding = importDeclaration.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502
- */
- public void test0439() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0439", "E.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType());
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622
- */
- public void test0440() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0440", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- // 2 * 3 + "" + (true)
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "2 * 3 + \"\" + (true)", source);
- Expression leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "2 * 3 + \"\"", source);
- checkSourceRange(infixExpression.getRightOperand(), "(true)", source);
- assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.PLUS);
- assertEquals("wrong type", ASTNode.INFIX_EXPRESSION, leftOperand.getNodeType());
- infixExpression = (InfixExpression) leftOperand;
- checkSourceRange(infixExpression, "2 * 3 + \"\"", source);
- leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "2 * 3", source);
- checkSourceRange(infixExpression.getRightOperand(), "\"\"", source);
- assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.PLUS);
- assertEquals("wrong type", ASTNode.INFIX_EXPRESSION, leftOperand.getNodeType());
- infixExpression = (InfixExpression) leftOperand;
- checkSourceRange(infixExpression, "2 * 3", source);
- leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "2", source);
- checkSourceRange(infixExpression.getRightOperand(), "3", source);
- assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.TIMES);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622
- */
- public void test0441() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0441", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "(2 + 2) * 3 * 1", source);
- Expression leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "(2 + 2)", source);
- checkSourceRange(infixExpression.getRightOperand(), "3", source);
- List extendedOperands = infixExpression.extendedOperands();
- assertEquals("wrong size", 1, extendedOperands.size());
- checkSourceRange((Expression) extendedOperands.get(0), "1", source);
- assertEquals("wrong operator", InfixExpression.Operator.TIMES, infixExpression.getOperator());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622
- */
- public void test0442() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0442", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "2 + (2 * 3) + 1", source);
- Expression leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "2", source);
- Expression rightOperand = infixExpression.getRightOperand();
- checkSourceRange(rightOperand, "(2 * 3)", source);
- assertEquals("wrong type", ASTNode.PARENTHESIZED_EXPRESSION, rightOperand.getNodeType());
- List extendedOperands = infixExpression.extendedOperands();
- assertEquals("wrong size", 1, extendedOperands.size());
- checkSourceRange((Expression) extendedOperands.get(0), "1", source);
- assertEquals("wrong operator", InfixExpression.Operator.PLUS, infixExpression.getOperator());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24623
- */
- public void test0443() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0443", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertNotNull("No body", methodDeclaration.getBody());
- assertNotNull("No binding", methodDeclaration.resolveBinding());
- assertTrue("Not an abstract method", Modifier.isAbstract(methodDeclaration.getModifiers()));
- assertTrue("Not malformed", isMalformed(methodDeclaration));
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24623
- */
- public void test0444() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0444", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0);
- assertEquals("Wrong type", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 2, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(0);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- assertEquals("Wrong name", "foo", methodDeclaration.getName().getIdentifier());
- assertNull("Got a binding", methodDeclaration.resolveBinding());
- bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(1);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType());
- assertEquals("Wrong name", "foo", ((FunctionDeclaration) bodyDeclaration).getName().getIdentifier());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24773
- */
- public void test0445() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0445", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25018
- */
- public void test0446() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0446", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$<
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25124
- */
- public void test0447() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0447", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 3, unit.getProblems().length); //$NON-NLS-1$<
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25330
- * @deprecated using deprecated code
- */
- public void test0448() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0448", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", node.getNodeType(), ASTNode.FUNCTION_DECLARATION);
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Not a constructor", methodDeclaration.isConstructor());
- ITypeBinding returnTypeBinding = methodDeclaration.getReturnType().resolveBinding();
- assertNotNull("No return type binding", returnTypeBinding);
- Block block = methodDeclaration.getBody();
- assertNotNull("No method body", block);
- assertEquals("wrong size", 0, block.statements().size());
- }
-
- /**
- * Check that the implicit super constructor call is not there
- */
- public void test0449() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0449", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", node.getNodeType(), ASTNode.FUNCTION_DECLARATION);
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Not a constructor", methodDeclaration.isConstructor());
- Block block = methodDeclaration.getBody();
- assertNotNull("No method body", block);
- assertEquals("wrong size", 1, block.statements().size());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26452
- */
- public void test0450() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0450", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0);
- assertEquals("Not a type declaration", node.getNodeType(), ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- assertTrue("not a class", typeBinding.isClass());
- assertTrue("not a toplevel type", typeBinding.isTopLevel());
- assertTrue("a local type", !typeBinding.isLocal());
- assertTrue("an anonymous type", !typeBinding.isAnonymous());
- assertTrue("a member type", !typeBinding.isMember());
- assertTrue("a nested type", !typeBinding.isNested());
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- Expression expression = ((ExpressionStatement) node).getExpression();
- assertEquals("Not a class instance creation", expression.getNodeType(), ASTNode.CLASS_INSTANCE_CREATION);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- typeBinding = anonymousClassDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- assertTrue("not a class", typeBinding.isClass());
- assertTrue("a toplevel type", !typeBinding.isTopLevel());
- assertTrue("not a local type", typeBinding.isLocal());
- assertTrue("not an anonymous type", typeBinding.isAnonymous());
- assertTrue("a member type", !typeBinding.isMember());
- assertTrue("not a nested type", typeBinding.isNested());
- ASTNode astNode = unit.findDeclaringNode(typeBinding);
- assertEquals("Wrong type", ASTNode.ANONYMOUS_CLASS_DECLARATION, astNode.getNodeType());
- assertNotNull("Didn't get a key", typeBinding.getKey());
- astNode = unit.findDeclaringNode(typeBinding.getKey());
- assertNotNull("Didn't get a declaring node", astNode);
-
- ITypeBinding typeBinding3 = classInstanceCreation.resolveTypeBinding();
- assertEquals("wrong binding", typeBinding, typeBinding3);
-
- List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
- assertEquals("wrong size", 2, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("not a type declaration", bodyDeclaration.getNodeType() == ASTNode.TYPE_DECLARATION);
- typeDeclaration = (TypeDeclaration) bodyDeclaration;
-
- bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(1);
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- assertNotNull("No body", block);
- List statements = block.statements();
- assertEquals("wrong size", 2, statements.size());
- Statement statement = (Statement) statements.get(1);
- assertEquals("Not a variable declaration statement", statement.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement;
- Type type = variableDeclarationStatement.getType();
- assertNotNull("No type", type);
-
- ITypeBinding typeBinding2 = type.resolveBinding();
- typeBinding = typeDeclaration.resolveBinding();
- assertTrue("not equals", typeBinding == typeBinding2);
- assertNotNull("No type binding", typeBinding);
- assertTrue("not a class", typeBinding.isClass());
- assertTrue("a toplevel type", !typeBinding.isTopLevel());
- assertTrue("an anonymous type", !typeBinding.isAnonymous());
- assertTrue("not a member type", typeBinding.isMember());
- assertTrue("not a nested type", typeBinding.isNested());
- assertTrue("a local type", !typeBinding.isLocal());
-
- bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("wrong size", 1, bodyDeclarations.size());
- bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("not a type declaration", bodyDeclaration.getNodeType() == ASTNode.TYPE_DECLARATION);
- typeDeclaration = (TypeDeclaration) bodyDeclaration;
- typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- assertTrue("not a class", typeBinding.isClass());
- assertTrue("a toplevel type", !typeBinding.isTopLevel());
- assertTrue("an anonymous type", !typeBinding.isAnonymous());
- assertTrue("not a member type", typeBinding.isMember());
- assertTrue("not a nested type", typeBinding.isNested());
- assertTrue("a local type", !typeBinding.isLocal());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24916
- * @deprecated using deprecated code
- */
- public void test0451() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0451", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Type type = methodDeclaration.getReturnType();
- checkSourceRange(type, "int", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=27204
- */
- public void test0452() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "NO_WORKING.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- SimpleName name = methodDeclaration.getName();
- assertEquals("wrong line number", 3, compilationUnit.getLineNumber(name.getStartPosition()));
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=27173
- */
- public void test0453() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0453", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0,0);
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("not a super method invocation", expression.getNodeType() == ASTNode.SUPER_METHOD_INVOCATION); //$NON-NLS-1$
- SuperMethodInvocation methodInvocation = (SuperMethodInvocation) expression;
- IFunctionBinding methodBinding = methodInvocation.resolveMethodBinding();
- assertNotNull("No method binding", methodBinding);
- assertEquals("Wrong binding", "toString", methodBinding.getName());
- }
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28296
- */
- public void test0454() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0454", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0,1);
- assertNotNull("No node", node);
- assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- checkSourceRange(expression, "(int) (3.14f * a)", source);
- }
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0455() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0455", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int i = 0; i < 10; i++) // for 1\n" +
- " for (int j = 0; j < 10; j++) // for 2\n" +
- " if (true) { }";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "for (int j = 0; j < 10; j++) // for 2\n" +
- " if (true) { }";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement2 = (ForStatement) body;
- body = forStatement2.getBody();
- expectedSource = "if (true) { }";
- checkSourceRange(body, expectedSource, source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0456() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0456", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int x= 10; x < 20; x++)\n" +
- " main();";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "main();";
- checkSourceRange(body, expectedSource, source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0457() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0457", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+
- " for (int z= 10; z < 10; z++)\n" +
- " foo();";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "for (int z= 10; z < 10; z++)\n" +
- " foo();";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement2 = (ForStatement) body;
- body = forStatement2.getBody();
- expectedSource = "foo();";
- checkSourceRange(body, expectedSource, source);
- }
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0458() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0458", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+
- " for (int z= 10; z < 10; z++)\n" +
- " ;";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "for (int z= 10; z < 10; z++)\n" +
- " ;";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement2 = (ForStatement) body;
- body = forStatement2.getBody();
- expectedSource = ";";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not an empty statement", body.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0459() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0459", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+
- " for (int z= 10; z < 10; z++)\n" +
- " { }";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "for (int z= 10; z < 10; z++)\n" +
- " { }";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement2 = (ForStatement) body;
- body = forStatement2.getBody();
- expectedSource = "{ }";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a block", body.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28869
- */
- public void test0460() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0460", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("Malformed", !isMalformed(node));
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28824
- */
- public void test0461() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0461", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("Malformed", !isMalformed(node));
- assertTrue("not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("not an assignment", expression.getNodeType() == ASTNode.ASSIGNMENT); //$NON-NLS-1$
- Assignment assignment = (Assignment) expression;
- checkSourceRange(assignment, "z= foo().y.toList()", source);
- Expression expression2 = assignment.getRightHandSide();
- checkSourceRange(expression2, "foo().y.toList()", source);
- assertTrue("not a method invocation", expression2.getNodeType() == ASTNode.FUNCTION_INVOCATION);
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- checkSourceRange(expression3, "foo().y", source);
- checkSourceRange(methodInvocation.getName(), "toList", source);
- assertTrue("not a field access", expression3.getNodeType() == ASTNode.FIELD_ACCESS);
- FieldAccess fieldAccess = (FieldAccess) expression3;
- checkSourceRange(fieldAccess.getName(), "y", source);
- Expression expression4 = fieldAccess.getExpression();
- checkSourceRange(expression4, "foo()", source);
- assertTrue("not a method invocation", expression4.getNodeType() == ASTNode.FUNCTION_INVOCATION);
- FunctionInvocation methodInvocation2 = (FunctionInvocation) expression4;
- checkSourceRange(methodInvocation2.getName(), "foo", source);
- assertNull("no null", methodInvocation2.getExpression());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=32338
- */
- public void test0462() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test462.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0);
- assertNotNull("No node", node);
- assertTrue("not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertEquals("Wrong name", "Test462", typeDeclaration.getName().getIdentifier());
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong name", "Test462", typeBinding.getQualifiedName());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33450
- */
- public void test0463() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0463", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertTrue("not a string literal", expression.getNodeType() == ASTNode.STRING_LITERAL); //$NON-NLS-1$
- StringLiteral stringLiteral = (StringLiteral) expression;
- checkSourceRange(stringLiteral, "\"\\012\\015\\u0061\"", source);
- assertEquals("wrong value", "\012\015a", stringLiteral.getLiteralValue());
- assertEquals("wrong value", "\"\\012\\015\\u0061\"", stringLiteral.getEscapedValue());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33039
- */
- public void test0464() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0464", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("No error", 1, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertTrue("not a null literal", expression.getNodeType() == ASTNode.NULL_LITERAL); //$NON-NLS-1$
- NullLiteral nullLiteral = (NullLiteral) expression;
- ITypeBinding typeBinding = nullLiteral.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding);
- assertFalse("A primitive type", typeBinding.isPrimitive());
- assertTrue("Null type", typeBinding.isNullType());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33831
- */
- public void test0465() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0465", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertTrue("not a field access", expression.getNodeType() == ASTNode.FIELD_ACCESS); //$NON-NLS-1$
- FieldAccess fieldAccess = (FieldAccess) expression;
- Name name = fieldAccess.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind());
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "i", variableBinding.getName());
- assertEquals("Wrong type", "int", variableBinding.getType().getName());
- IVariableBinding variableBinding2 = fieldAccess.resolveFieldBinding();
- assertTrue("different binding", variableBinding == variableBinding2);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33949
- */
- public void test0466() throws JavaScriptModelException {
- Hashtable options = JavaScriptCore.getOptions();
- Hashtable newOptions = JavaScriptCore.getOptions();
- try {
- newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- JavaScriptCore.setOptions(newOptions);
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0466", "Assert.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- checkSourceRange(node, "assert ref != null : message;", source);
- } finally {
- JavaScriptCore.setOptions(options);
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33949
- */
- public void test0467() throws JavaScriptModelException {
- Hashtable options = JavaScriptCore.getOptions();
- Hashtable newOptions = JavaScriptCore.getOptions();
- try {
- newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- JavaScriptCore.setOptions(newOptions);
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0467", "Assert.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- checkSourceRange(node, "assert ref != null : message\\u003B", source);
-
- node = getASTNode(compilationUnit, 0, 0, 1);
- checkSourceRange(node, "assert ref != null\\u003B", source);
- } finally {
- JavaScriptCore.setOptions(options);
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=36772
- */
- public void test0468() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0468", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertTrue("not a field access", expression.getNodeType() == ASTNode.FIELD_ACCESS); //$NON-NLS-1$
- FieldAccess fieldAccess = (FieldAccess) expression;
- Name name = fieldAccess.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind());
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "i", variableBinding.getName());
- assertEquals("Wrong type", "int", variableBinding.getType().getName());
- IVariableBinding variableBinding2 = fieldAccess.resolveFieldBinding();
- assertTrue("different binding", variableBinding == variableBinding2);
-
- node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("No node", node);
- assertEquals("Wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
-
- ASTNode foundNode = compilationUnit.findDeclaringNode(variableBinding);
- assertNotNull("No found node", foundNode);
- assertEquals("wrong node", fragment, foundNode);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=36895
- */
- public void test0469() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "codeManipulation", "bug.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 2, 0);
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- ASTNode parent = node.getParent();
- assertNotNull(parent);
- assertTrue("not a block", parent.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=37381
- */
- public void test0470() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0470", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- List initializers = forStatement.initializers();
- assertEquals("wrong size", 1, initializers.size());
- Expression initializer = (Expression) initializers.get(0);
- assertTrue("not a variable declaration expression", initializer.getNodeType() == ASTNode.VARIABLE_DECLARATION_EXPRESSION); //$NON-NLS-1$
- VariableDeclarationExpression variableDeclarationExpression = (VariableDeclarationExpression) initializer;
- List fragments = variableDeclarationExpression.fragments();
- assertEquals("wrong size", 2, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- checkSourceRange(fragment, "i= 0", source);
- fragment = (VariableDeclarationFragment) fragments.get(1);
- checkSourceRange(fragment, "j= goo(3)", source);
- checkSourceRange(variableDeclarationExpression, "int i= 0, j= goo(3)", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=38447
- */
- public void test0471() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0471", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No error", 1, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Is a constructor", !methodDeclaration.isConstructor());
- checkSourceRange(methodDeclaration, "private void foo(){", source);
- node = getASTNode(compilationUnit, 0, 1);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Is a constructor", !methodDeclaration.isConstructor());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=38447
- */
- public void test0472() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "junit.textui", "ResultPrinter.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No error", 2, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 2);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Not a constructor", methodDeclaration.isConstructor());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=38732
- */
- public void test0473() throws JavaScriptModelException {
- Hashtable options = JavaScriptCore.getOptions();
- Hashtable newOptions = JavaScriptCore.getOptions();
- try {
- newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- newOptions.put(JavaScriptCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaScriptCore.ERROR);
- JavaScriptCore.setOptions(newOptions);
-
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0473", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No error", 2, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- } finally {
- JavaScriptCore.setOptions(options);
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39259
- */
- public void test0474() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0474", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertNotNull("No node", node);
- assertEquals("Not a while statement", node.getNodeType(), ASTNode.WHILE_STATEMENT);
- WhileStatement whileStatement = (WhileStatement) node;
- Statement statement = whileStatement.getBody();
- assertEquals("Not a while statement", statement.getNodeType(), ASTNode.WHILE_STATEMENT);
- WhileStatement whileStatement2 = (WhileStatement) statement;
- String expectedSource =
- "while(b())\n" +
- " foo();";
- checkSourceRange(whileStatement2, expectedSource, source);
- Statement statement2 = whileStatement2.getBody();
- checkSourceRange(statement2, "foo();", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39259
- */
- public void test0475() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0475", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertNotNull("No node", node);
- assertEquals("Not an if statement", node.getNodeType(), ASTNode.IF_STATEMENT);
- IfStatement statement = (IfStatement) node;
- Statement statement2 = statement.getThenStatement();
- assertEquals("Not an if statement", statement2.getNodeType(), ASTNode.IF_STATEMENT);
- IfStatement statement3 = (IfStatement) statement2;
- String expectedSource =
- "if(b())\n" +
- " foo();";
- checkSourceRange(statement3, expectedSource, source);
- Statement statement4 = statement3.getThenStatement();
- checkSourceRange(statement4, "foo();", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39259
- */
- public void test0476() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0476", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertNotNull("No node", node);
- assertEquals("Not a for statement", node.getNodeType(), ASTNode.FOR_STATEMENT);
- ForStatement statement = (ForStatement) node;
- Statement statement2 = statement.getBody();
- assertEquals("Not a for statement", statement2.getNodeType(), ASTNode.FOR_STATEMENT);
- ForStatement statement3 = (ForStatement) statement2;
- String expectedSource =
- "for(;b();)\n" +
- " foo();";
- checkSourceRange(statement3, expectedSource, source);
- Statement statement4 = statement3.getBody();
- checkSourceRange(statement4, "foo();", source);
- }
-
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39327
- */
- public void test0477() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0477", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No error", 1, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertNotNull("No node", node);
-
- checkSourceRange(node, "this(undef());", source);
- assertEquals("Not a constructor invocation", node.getNodeType(), ASTNode.CONSTRUCTOR_INVOCATION);
- ConstructorInvocation constructorInvocation = (ConstructorInvocation) node;
- List arguments = constructorInvocation.arguments();
- assertEquals("Wrong size", 1, arguments.size());
- IFunctionBinding binding = constructorInvocation.resolveConstructorBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0478() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0478", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 2, types.length);
- IType type = types[1];
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertNotNull(methodBinding);
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 2, statements.size());
- ASTNode node2 = (ASTNode) statements.get(1);
- assertNotNull(node2);
- assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IFunctionBinding methodBinding2 = (IFunctionBinding) binding2;
- assertEquals("Wrong name", "clone", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0479() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0479", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 2, types.length);
- IType type = types[1];
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 2, statements.size());
- ASTNode node2 = (ASTNode) statements.get(1);
- assertNotNull(node2);
- assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNull("No binding", binding); //$NON-NLS-1$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0480() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0480", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0481() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0481", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node2;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding();
- assertNotNull(typeBinding);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0482() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0482", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IType[] memberTypes = type.getTypes();
- assertNotNull(memberTypes);
- assertEquals("wrong size", 1, memberTypes.length);
- IType memberType = memberTypes[0];
- IFunction[] methods = memberType.getFunctions();
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node2;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding();
- assertNotNull(typeBinding);
- assertTrue(typeBinding.isAnonymous());
- assertEquals("Wrong name", "", typeBinding.getName());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0483() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0483", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IFunction[] methods = type.getFunctions();
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "A", methodDeclaration.getName().getIdentifier());
- assertTrue("Not a constructor", methodDeclaration.isConstructor());
- IBinding binding = methodDeclaration.getName().resolveBinding();
- assertNotNull(binding);
- assertEquals("Wrong type", IBinding.METHOD, binding.getKind());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node2;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding();
- assertNotNull(typeBinding);
- assertTrue(typeBinding.isAnonymous());
- assertEquals("Wrong name", "", typeBinding.getName());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0484() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0482", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IType[] memberTypes = type.getTypes();
- assertNotNull(memberTypes);
- assertEquals("wrong size", 1, memberTypes.length);
- IType memberType = memberTypes[0];
- ISourceRange sourceRange = memberType.getSourceRange();
- ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier());
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0485() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0482", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IType[] memberTypes = type.getTypes();
- assertNotNull(memberTypes);
- assertEquals("wrong size", 1, memberTypes.length);
- IType memberType = memberTypes[0];
- ISourceRange sourceRange = memberType.getSourceRange();
- ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier());
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0486() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0486", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IFunction[] methods = type.getFunctions();
- assertEquals("wrong size", 2, methods.length);
- IFunction method = methods[1];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 2);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 2, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0487() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0487", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IFunction[] methods = type.getFunctions();
- assertEquals("wrong size", 3, methods.length);
- IFunction method = methods[1];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 2, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 4);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Wrong name", "field", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- fragment = (VariableDeclarationFragment) fragments.get(0);
- expression = fragment.getInitializer();
- assertEquals("Wrong name", "i", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 2);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- Initializer initializer = (Initializer) node;
- assertEquals("Not static", Modifier.NONE, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 3);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- initializer = (Initializer) node;
- assertEquals("Not static", Modifier.STATIC, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 6);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0488() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0488", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IInitializer[] initializers = type.getInitializers();
- assertEquals("wrong size", 2, initializers.length);
- IInitializer init = initializers[1];
- ISourceRange sourceRange = init.getSourceRange();
- ASTNode result = runConversion(sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 4);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Wrong name", "field", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- fragment = (VariableDeclarationFragment) fragments.get(0);
- expression = fragment.getInitializer();
- assertEquals("Wrong name", "i", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 2);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- Initializer initializer = (Initializer) node;
- assertEquals("Not static", Modifier.NONE, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 3);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- initializer = (Initializer) node;
- assertEquals("Not static", Modifier.STATIC, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 6);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
- }
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=40804
- */
- public void test0489() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0489", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertNull("Got a type binding", typeDeclaration.resolveBinding());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=40804
- */
- public void test0490() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0490", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42647
- */
- public void test0491() throws JavaScriptModelException {
- Hashtable options = JavaScriptCore.getOptions();
- Hashtable newOptions = JavaScriptCore.getOptions();
- try {
- newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- JavaScriptCore.setOptions(newOptions);
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0491", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- } finally {
- JavaScriptCore.setOptions(options);
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42647
- */
- public void test0492() throws JavaScriptModelException {
- Hashtable options = JavaScriptCore.getOptions();
- Hashtable newOptions = JavaScriptCore.getOptions();
- try {
- newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- JavaScriptCore.setOptions(newOptions);
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0492", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- } finally {
- JavaScriptCore.setOptions(options);
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839
- */
- public void test0493() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0493", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Class[][]", source);
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type componentType = arrayType.getComponentType();
- assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class[]", source);
- arrayType = (ArrayType) componentType;
- componentType = arrayType.getComponentType();
- assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839
- */
- public void test0494() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0494", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Class[][][]", source);
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type componentType = arrayType.getComponentType();
- assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class[][]", source);
- arrayType = (ArrayType) componentType;
- componentType = arrayType.getComponentType();
- assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class[]", source);
- arrayType = (ArrayType) componentType;
- componentType = arrayType.getComponentType();
- assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839
- */
- public void test0495() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0495", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Class[][]", source);
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type componentType = arrayType.getComponentType();
- assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class[]", source);
- arrayType = (ArrayType) componentType;
- componentType = arrayType.getComponentType();
- assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class", source);
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- assertEquals("wrong extra dimension", 1, fragment.getExtraDimensions());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839
- */
- public void test0496() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0496", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Class[][][][]", source);
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type componentType = arrayType.getComponentType();
- assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class[][][]", source);
- arrayType = (ArrayType) componentType;
- componentType = arrayType.getComponentType();
- assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class[][]", source);
- arrayType = (ArrayType) componentType;
- componentType = arrayType.getComponentType();
- assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class[]", source);
- arrayType = (ArrayType) componentType;
- componentType = arrayType.getComponentType();
- assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839
- */
- public void test0497() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0497", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Class[]", source);
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type componentType = arrayType.getComponentType();
- assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class", source);
- }
-
- /**
- */
- public void test0498() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0498", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=45199
- */
- public void test0499() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0499", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 1);
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- Expression expression = ((ExpressionStatement) node).getExpression();
- assertTrue("Not an assignment", expression.getNodeType() == ASTNode.ASSIGNMENT); //$NON-NLS-1$
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getRightHandSide();
- assertTrue("Not an infix expression", expression2.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expression2;
- Expression expression3 = infixExpression.getLeftOperand();
- assertTrue("Not a simple name", expression3.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- ITypeBinding binding = expression3.resolveTypeBinding();
- assertNotNull("No binding", binding);
- Expression expression4 = assignment.getLeftHandSide();
- assertTrue("Not a simple name", expression4.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- ITypeBinding binding2 = expression4.resolveTypeBinding();
- assertNotNull("No binding", binding2);
- assertTrue("Should be the same", binding == binding2);
- }
-
- /**
- * Test for bug 45436 fix.
- * When this bug happened, the first assertion was false (2 problems found).
- * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45436">bug 45436</a>
- * @throws JavaScriptModelException
- */
- public void test0500() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0500", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IJavaScriptProject project = sourceUnit.getJavaScriptProject();
- Map originalOptions = project.getOptions(false);
- try {
- project.setOption(JavaScriptCore.COMPILER_PB_INVALID_JAVADOC, JavaScriptCore.ERROR);
- project.setOption(JavaScriptCore.COMPILER_PB_MISSING_JAVADOC_TAGS, JavaScriptCore.ERROR);
- project.setOption(JavaScriptCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS, JavaScriptCore.ERROR);
- JavaScriptUnit result = (JavaScriptUnit)runConversion(sourceUnit, true);
- IProblem[] problems= result.getProblems();
- assertTrue(problems.length == 1);
- assertEquals("Invalid warning", "Javadoc: Missing tag for parameter a", problems[0].getMessage());
- } finally {
- project.setOptions(originalOptions);
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46012
- */
- public void test0501() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0501", "JavaEditor.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull(result);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502a() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // 'i' in initializer
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement)getASTNode(unit, 0, 0, 0);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
- IVariableBinding localBinding = fragment.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A;#0#i", localBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502b() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // 'j' in 'then' block in initializer
- IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 0, 1);
- Block block = (Block)ifStatement.getThenStatement();
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) block.statements().get(0);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
- IVariableBinding localBinding = fragment.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A;#0#0#j", localBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502c() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // 'i' in 'foo()'
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement)getASTNode(unit, 0, 1, 0);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
- IVariableBinding localBinding = fragment.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A;.foo()V#i", localBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502d() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // 'j' in 'then' block in 'foo()'
- IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 1, 1);
- Block block = (Block)ifStatement.getThenStatement();
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) block.statements().get(0);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
- IVariableBinding localBinding = fragment.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A;.foo()V#0#j", localBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502e() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // 'j' in 'else' block in 'foo()'
- IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 1, 1);
- Block block = (Block)ifStatement.getElseStatement();
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) block.statements().get(0);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
- IVariableBinding localBinding = fragment.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A;.foo()V#1#j", localBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502f() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // first 'new Object(){...}' in 'foo()'
- ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 2);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A$182;", typeBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- * @deprecated using deprecated code
- */
- public void test0502g() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // 'B' in 'foo()'
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 3);
- TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration();
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A$206$B;", typeBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502h() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // second 'new Object(){...}' in 'foo()'
- ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 4);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A$255;", typeBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- * @deprecated using deprecated code
- */
- public void test0502i() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // 'field' in 'B' in 'foo()'
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 3);
- TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration();
- FieldDeclaration fieldDeclaration = typeDeclaration.getFields()[0];
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fieldDeclaration.fragments().get(0);
- IVariableBinding fieldBinding = fragment.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A$206$B;.field)I", fieldBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- * @deprecated using deprecated code
- */
- public void test0502j() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // 'bar()' in 'B' in 'foo()'
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 3);
- TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration();
- FunctionDeclaration methodDeclaration = typeDeclaration.getMethods()[0];
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A$206$B;.bar()V", methodBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503a() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // top level type A
- TypeDeclaration type = (TypeDeclaration)getASTNode(unit, 0);
- ITypeBinding typeBinding = type.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503b() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // member type B in A
- TypeDeclaration type = (TypeDeclaration)getASTNode(unit, 0, 0);
- ITypeBinding typeBinding = type.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A$B", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- * @deprecated using deprecated code
- */
- public void test0503c() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // local type E in foo() in A
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 0);
- TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration();
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A$1$E", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503d() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // anonymous type new Object() {...} in foo() in A
- ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 1);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A$2", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503e() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // type F in anonymous type new Object() {...} in foo() in A
- ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 1);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- TypeDeclaration type = (TypeDeclaration) anonymousClassDeclaration.bodyDeclarations().get(0);
- ITypeBinding typeBinding = type.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A$2$F", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- * @deprecated using deprecated code
- */
- public void test0503f() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // local type C in bar() in B in A
- FunctionDeclaration method = (FunctionDeclaration) getASTNode(unit, 0, 0, 0);
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) method.getBody().statements().get(0);
- TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration();
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A$1$C", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503g() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // anonymous type new Object() {...} in bar() in B in A
- FunctionDeclaration method = (FunctionDeclaration) getASTNode(unit, 0, 0, 0);
- ExpressionStatement expressionStatement = (ExpressionStatement) method.getBody().statements().get(1);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A$1", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503h() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // type D in anonymous type new Object() {...} in bar() in B in A
- FunctionDeclaration method = (FunctionDeclaration) getASTNode(unit, 0, 0, 0);
- ExpressionStatement expressionStatement = (ExpressionStatement) method.getBody().statements().get(1);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- TypeDeclaration type = (TypeDeclaration) anonymousClassDeclaration.bodyDeclarations().get(0);
- ITypeBinding typeBinding = type.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A$1$D", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- * @deprecated using deprecated code
- */
- public void test0503i() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(sourceUnit, true);
-
- // unreachable type G in foo() in A
- IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 1, 2);
- Block block = (Block)ifStatement.getThenStatement();
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) block.statements().get(0);
- TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration();
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Unexpected binary name", null, typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=47396
- */
- public void test0504() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0504", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 1, 0);
- assertNotNull(node);
- assertTrue("Not a constructor declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- assertTrue("A constructor", !declaration.isConstructor());
- checkSourceRange(declaration, "public method(final int parameter);", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=47396
- */
- public void test0505() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0505", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 1, 0);
- assertNotNull(node);
- assertTrue("Not a constructor declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- assertTrue("A constructor", !declaration.isConstructor());
- checkSourceRange(declaration, "public method(final int parameter) { }", source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699
- */
- public void test0506() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0506", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertTrue("is default constructor", binding.isDefaultConstructor());
- assertNull("Has a declaring node", unit.findDeclaringNode(binding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699
- */
- public void test0507() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0507", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertTrue("is default constructor", binding.isDefaultConstructor());
- assertNull("Has a declaring node", unit.findDeclaringNode(binding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699
- */
- public void test0508() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0508", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 1, 0);
- assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertTrue("not a default constructor", !binding.isDefaultConstructor());
- assertNotNull("Has no declaring node", unit.findDeclaringNode(binding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699
- */
- public void test0509() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0509", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertTrue("not a default constructor", !binding.isDefaultConstructor());
- assertNull("Has a declaring node", unit.findDeclaringNode(binding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699
- */
- public void test0510() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0510", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertFalse("is default constructor", binding.isDefaultConstructor());
- assertNull("Has a declaring node", unit.findDeclaringNode(binding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699
- */
- public void test0511() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0511", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertFalse("is default constructor", binding.isDefaultConstructor());
- assertNull("Has a declaring node", unit.findDeclaringNode(binding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=47326
- */
- public void test0512() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0512", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- assertTrue("Not a constructor", declaration.isConstructor());
- checkSourceRange(declaration, "public A();", source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=49429
- */
- public void test0513() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0513", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48502
- */
- public void test0514() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0514", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=49204
- */
- public void test0515() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0515", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a if statement", node.getNodeType() == ASTNode.IF_STATEMENT);
- IfStatement ifStatement = (IfStatement) node;
- assertTrue("not an empty statement", ifStatement.getThenStatement().getNodeType() == ASTNode.EMPTY_STATEMENT);
- checkSourceRange(ifStatement.getThenStatement(), ";", source);
- Statement statement = ifStatement.getElseStatement();
- assertTrue("not a if statement", statement.getNodeType() == ASTNode.IF_STATEMENT);
- ifStatement = (IfStatement) statement;
- assertTrue("not an empty statement", ifStatement.getThenStatement().getNodeType() == ASTNode.EMPTY_STATEMENT);
- checkSourceRange(ifStatement.getThenStatement(), ";", source);
- Statement statement2 = ifStatement.getElseStatement();
- assertTrue("not an empty statement", statement2.getNodeType() == ASTNode.EMPTY_STATEMENT);
- checkSourceRange(statement2, ";", source);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- * @deprecated using deprecated code
- */
- public void test0516() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0516", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION);
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
- parser.setSource(source);
- parser.setSourceRange(declaration.getStartPosition(), declaration.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a type declaration", result2.getNodeType() == ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) result2;
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue(declaration.subtreeMatch(new ASTMatcher(), bodyDeclaration));
- ASTNode root = bodyDeclaration.getRoot();
- assertNotNull("No root", root);
- assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) root;
- assertEquals("wrong problem size", 0, compilationUnit.getProblems().length);
- assertNotNull("No comments", compilationUnit.getCommentList());
- assertEquals("Wrong size", 3, compilationUnit.getCommentList().size());
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- * @deprecated using deprecated code
- */
- public void test0517() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0517", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No comments", unit.getCommentList());
- assertEquals("Wrong size", 3, unit.getCommentList().size());
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION);
- FieldDeclaration declaration = (FieldDeclaration) node;
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
- parser.setSource(source);
- parser.setSourceRange(declaration.getStartPosition(), declaration.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a type declaration", result2.getNodeType() == ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) result2;
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue(declaration.subtreeMatch(new ASTMatcher(), bodyDeclaration));
- ASTNode root = bodyDeclaration.getRoot();
- assertNotNull("No root", root);
- assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) root;
- assertEquals("wrong problem size", 0, compilationUnit.getProblems().length);
- assertNotNull("No comments", compilationUnit.getCommentList());
- assertEquals("Wrong size", 2, compilationUnit.getCommentList().size());
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- * @deprecated using deprecated code
- */
- public void test0518() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0518", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not an initializer", node.getNodeType() == ASTNode.INITIALIZER);
- Initializer declaration = (Initializer) node;
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
- parser.setSource(source);
- parser.setSourceRange(declaration.getStartPosition(), declaration.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a type declaration", result2.getNodeType() == ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) result2;
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue(declaration.subtreeMatch(new ASTMatcher(), bodyDeclaration));
- ASTNode root = bodyDeclaration.getRoot();
- assertNotNull("No root", root);
- assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) root;
- assertEquals("wrong problem size", 0, compilationUnit.getProblems().length);
- assertNotNull("No comments", compilationUnit.getCommentList());
- assertEquals("Wrong size", 3, compilationUnit.getCommentList().size());
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- * @deprecated using deprecated code
- */
- public void test0519() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0519", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No comments", unit.getCommentList());
- assertEquals("Wrong size", 2, unit.getCommentList().size());
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- ASTNode statement = node;
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setKind(ASTParser.K_STATEMENTS);
- parser.setSource(source);
- parser.setSourceRange(statement.getStartPosition(), statement.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a block", result2.getNodeType() == ASTNode.BLOCK);
- Block block = (Block) result2;
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size());
- Statement statement2 = (Statement) statements.get(0);
- assertTrue(statement.subtreeMatch(new ASTMatcher(), statement2));
- ASTNode root = statement2.getRoot();
- assertNotNull("No root", root);
- assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) root;
- assertEquals("wrong problem size", 0, compilationUnit.getProblems().length);
- assertNotNull("No comments", compilationUnit.getCommentList());
- assertEquals("Wrong size", 1, compilationUnit.getCommentList().size());
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- * @deprecated using deprecated code
- */
- public void test0520() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0520", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No comments", unit.getCommentList());
- assertEquals("Wrong size", 2, unit.getCommentList().size());
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a block", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setKind(ASTParser.K_EXPRESSION);
- parser.setSource(source);
- parser.setSourceRange(expression.getStartPosition(), expression.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a method invocation", result2.getNodeType() == ASTNode.FUNCTION_INVOCATION);
- assertTrue(expression.subtreeMatch(new ASTMatcher(), result2));
- ASTNode root = result2.getRoot();
- assertNotNull("No root", root);
- assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) root;
- assertEquals("wrong problem size", 0, compilationUnit.getProblems().length);
- assertNotNull("No comments", compilationUnit.getCommentList());
- assertEquals("Wrong size", 1, compilationUnit.getCommentList().size());
- }
- /**
- * Ensure an OperationCanceledException is correcly thrown when progress monitor is canceled
- * @deprecated using deprecated code
- */
- public void test0521() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0521", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- // count the number of time isCanceled() is called when converting this source unit
- WorkingCopyOwner owner = new WorkingCopyOwner() {};
- CancelCounter counter = new CancelCounter();
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setSource(sourceUnit);
- parser.setResolveBindings(true);
- parser.setWorkingCopyOwner(owner);
- parser.createAST(counter);
-
- // throw an OperatonCanceledException at each point isCanceled() is called
- for (int i = 0; i < counter.count; i++) {
- boolean gotException = false;
- try {
- parser = ASTParser.newParser(AST.JLS2);
- parser.setSource(sourceUnit);
- parser.setResolveBindings(true);
- parser.setWorkingCopyOwner(owner);
- parser.createAST(new Canceler(i));
- } catch (OperationCanceledException e) {
- gotException = true;
- }
- assertTrue("Should get an OperationCanceledException (" + i + ")", gotException);
- }
-
- // last should not throw an OperationCanceledException
- parser = ASTParser.newParser(AST.JLS2);
- parser.setSource(sourceUnit);
- parser.setResolveBindings(true);
- parser.setWorkingCopyOwner(owner);
- parser.createAST(new Canceler(counter.count));
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0522() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0522", "Test.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- assertNotNull(type);
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 2, methods.length);
- IFunction method = methods[1];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertNotNull(methodBinding);
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 2, statements.size());
- ASTNode node2 = (ASTNode) statements.get(1);
- assertNotNull(node2);
- assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IFunctionBinding methodBinding2 = (IFunctionBinding) binding2;
- assertEquals("Wrong name", "clone", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0523() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0523", "Test.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- assertNotNull(type);
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 2, methods.length);
- IFunction method = methods[1];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 2, statements.size());
- ASTNode node2 = (ASTNode) statements.get(1);
- assertNotNull(node2);
- assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNull("No binding", binding); //$NON-NLS-1$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0524() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0524", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- assertNotNull(type);
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 2, methods.length);
- IFunction method = methods[1];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0525() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0525", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- assertNotNull(type);
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 2, methods.length);
- IFunction method = methods[1];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node2;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding();
- assertNotNull(typeBinding);
- }
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0526() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0526", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- assertNotNull(type);
- IType[] memberTypes = type.getTypes();
- assertNotNull(memberTypes);
- assertEquals("wrong size", 1, memberTypes.length);
- IType memberType = memberTypes[0];
- IFunction[] methods = memberType.getFunctions();
- assertEquals("wrong size", 2, methods.length);
- IFunction method = methods[1];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node2;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding();
- assertNotNull(typeBinding);
- assertTrue(typeBinding.isAnonymous());
- assertEquals("Wrong name", "", typeBinding.getName());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0527() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0527", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- assertNotNull(type);
- IFunction[] methods = type.getFunctions();
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "A", methodDeclaration.getName().getIdentifier());
- assertTrue("Not a constructor", methodDeclaration.isConstructor());
- IBinding binding = methodDeclaration.getName().resolveBinding();
- assertNotNull(binding);
- assertEquals("Wrong type", IBinding.METHOD, binding.getKind());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node2;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding();
- assertNotNull(typeBinding);
- assertTrue(typeBinding.isAnonymous());
- assertEquals("Wrong name", "", typeBinding.getName());
- }
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0528() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0528", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- IType[] memberTypes = type.getTypes();
- assertNotNull(memberTypes);
- assertEquals("wrong size", 1, memberTypes.length);
- IType memberType = memberTypes[0];
- ISourceRange sourceRange = memberType.getSourceRange();
- ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier());
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- }
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0529() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0529", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- IType[] memberTypes = type.getTypes();
- assertNotNull(memberTypes);
- assertEquals("wrong size", 1, memberTypes.length);
- IType memberType = memberTypes[0];
- ISourceRange sourceRange = memberType.getSourceRange();
- ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier());
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0530() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0530", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- IFunction[] methods = type.getFunctions();
- assertEquals("wrong size", 3, methods.length);
- IFunction method = methods[2];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 2);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 2, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
- }
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0531() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0531", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- IFunction[] methods = type.getFunctions();
- assertEquals("wrong size", 5, methods.length);
- IFunction method = methods[3];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 2, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 4);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Wrong name", "field", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- fragment = (VariableDeclarationFragment) fragments.get(0);
- expression = fragment.getInitializer();
- assertEquals("Wrong name", "i", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 2);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- Initializer initializer = (Initializer) node;
- assertEquals("Not static", Modifier.NONE, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 3);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- initializer = (Initializer) node;
- assertEquals("Not static", Modifier.STATIC, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 6);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0532() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0488", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IInitializer[] initializers = type.getInitializers();
- assertEquals("wrong size", 2, initializers.length);
- IInitializer init = initializers[1];
- ISourceRange sourceRange = init.getSourceRange();
- int position = sourceRange.getOffset() + sourceRange.getLength() / 2;
-
- IClassFile classFile = getClassFile("Converter" , "bins", "test0532", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- type = classFile.getType();
- initializers = type.getInitializers();
- assertEquals("wrong size", 0, initializers.length);
- ASTNode result = runConversion(classFile, position, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 4);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Wrong name", "field", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- fragment = (VariableDeclarationFragment) fragments.get(0);
- expression = fragment.getInitializer();
- assertEquals("Wrong name", "i", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 2);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- Initializer initializer = (Initializer) node;
- assertEquals("Not static", Modifier.NONE, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 3);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- initializer = (Initializer) node;
- assertEquals("Not static", Modifier.STATIC, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 6);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- * @deprecated using deprecated code
- */
- public void test0533() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0533", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION);
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
- parser.setSource(source);
- parser.setSourceRange(declaration.getStartPosition(), declaration.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a compilation unit", result2.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result2;
- assertEquals("wrong problem size", 1, compilationUnit.getProblems().length);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- * @deprecated using deprecated code
- */
- public void test0534() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0534", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION);
- FieldDeclaration declaration = (FieldDeclaration) node;
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
- parser.setSource(source);
- parser.setSourceRange(declaration.getStartPosition(), declaration.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a compilation unit", result2.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result2;
- assertEquals("wrong problem size", 1, compilationUnit.getProblems().length);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- * @deprecated using deprecated code
- */
- public void test0535() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0535", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not an initializer", node.getNodeType() == ASTNode.INITIALIZER);
- Initializer declaration = (Initializer) node;
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
- parser.setSource(source);
- parser.setSourceRange(declaration.getStartPosition(), declaration.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a compilation unit", result2.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result2;
- assertEquals("wrong problem size", 1, compilationUnit.getProblems().length);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=47396
- */
- public void test0536() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0536", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("No compilation unit", result);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=51089
- */
- public void test0537a() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0537", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("No compilation unit", result);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=51089
- */
- public void test0537b() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0537", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("No compilation unit", result);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=51089
- */
- public void test0537c() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0537", "C.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertNotNull("No compilation unit", result);
- }
- /**
- * Ensures that an AST can be created during reconcile.
- * @deprecated using deprecated code
- */
- public void test0538a() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- sourceUnit.becomeWorkingCopy(null);
- sourceUnit.getBuffer().setContents(
- "package test0538;\n" +
- "public class A {\n" +
- " int i;\n" +
- "}"
- );
- JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null);
- assertNotNull("No level 2 compilation unit", unit);
- assertEquals("Compilation unit has wrong AST level (2)", AST.JLS2, unit.getAST().apiLevel());
- // TODO improve test for AST.JLS3
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /*
- * Ensures that no AST is created during reconcile if not requested.
- */
- public void test0538b() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- sourceUnit.becomeWorkingCopy(null);
- sourceUnit.getBuffer().setContents(
- "package test0538;\n" +
- "public class A {\n" +
- " int i;\n" +
- "}"
- );
- JavaScriptUnit unit = sourceUnit.reconcile(0, false, null, null);
- assertNull("Unexpected compilation unit", unit);
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /**
- * Ensures that no AST is created during reconcile if consistent.
- * @deprecated using deprecated code
- */
- public void test0538c() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- sourceUnit.becomeWorkingCopy(null);
- JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null);
- assertNull("Unexpected compilation unit", unit);
- // TODO improve test for AST.JLS3
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /**
- * Ensures that bindings are created during reconcile if the problem requestor is active.
- * @deprecated using deprecated code
- */
- public void test0538d() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor();
- sourceUnit.becomeWorkingCopy(null);
- sourceUnit.getBuffer().setContents(
- "package test0538;\n" +
- "public class A {\n" +
- " Object field;\n" +
- "}"
- );
- // TODO improve test for AST.JLS3
- JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null);
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("Not original", isOriginal(node));
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION);
- FieldDeclaration declaration = (FieldDeclaration) node;
- Type type = declaration.getType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- assertEquals("Wrong name", "Object", typeBinding.getName());
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /**
- * Ensures that bindings are created during reconcile if force problem detection is turned on.
- * @deprecated using deprecated code
- */
- public void test0538e() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor();
- sourceUnit.becomeWorkingCopy(null);
- // TODO improve test for AST.JLS3
- JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, true/*force pb detection*/, null, null);
- ASTNode node = getASTNode(unit, 0);
- assertNotNull("No node", node);
- assertTrue("not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION);
- TypeDeclaration declaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = declaration.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- assertEquals("Wrong name", "A", typeBinding.getName());
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /**
- * Ensures that bindings are created during reconcile if force problem detection is turned on.
- * Case of a unit containing an anonymous type.
- * (regression test for bug 55102 NPE when using ICU.reconcile(GET_AST_TRUE, ...))
- * @deprecated using deprecated code
- */
- public void test0538f() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor();
- sourceUnit.becomeWorkingCopy(null);
- sourceUnit.getBuffer().setContents(
- "package test0538;\n" +
- "public class A {\n" +
- " void foo() {\n" +
- " new Object() {\n" +
- " void bar() {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}"
- );
- // TODO improve test for AST.JLS3
- JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, true/*force pb detection*/, null, null);
- ASTNode node = getASTNode(unit, 0);
- assertNotNull("No node", node);
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /**
- * Ensures that bindings are created during reconcile if force problem detection is turned on.
- * Case of a unit containing an anonymous type.
- * (regression test for bug 55102 NPE when using ICU.reconcile(GET_AST_TRUE, ...))
- * @deprecated using deprecated code
- */
- public void test0538g() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor();
- sourceUnit.becomeWorkingCopy(null);
- sourceUnit.getBuffer().setContents(
- "package test0538;\n" +
- "public class A {\n" +
- " void foo() {\n" +
- " new Object() {\n" +
- " void bar() {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}"
- );
- sourceUnit.reconcile(IJavaScriptUnit.NO_AST, false/* don't force pb detection*/, null, null);
- // TODO improve test for AST.JLS3
- JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, true/*force pb detection*/, null, null);
- ASTNode node = getASTNode(unit, 0);
- assertNotNull("No node", node);
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /**
- * Ensures that asking for well known type doesn't throw a NPE if the problem requestor is not active.
- * (regression test for bug 64750 NPE in Java AST Creation - editing some random file)
- * @deprecated using deprecated code
- */
- public void test0538h() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor() {
- public boolean isActive() {
- return false;
- }
- };
- sourceUnit.becomeWorkingCopy(null);
- sourceUnit.getBuffer().setContents(
- "package test0538;\n" +
- "public class A {\n" +
- " Object field;\n" +
- "}"
- );
- // TODO improve test for AST.JLS3
- JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null);
- assertEquals("Unexpected well known type", null, unit.getAST().resolveWellKnownType("void"));
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=53477
- */
- public void test0539() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0539", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 1, 0);
- assertNotNull("No node", node);
- assertTrue("not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- checkSourceRange(classInstanceCreation, "new A(){}.new Inner(){/*x*/}", source);
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- Expression expression2 = classInstanceCreation.getExpression();
- assertTrue("not a class instance creation", expression2.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION);
- ClassInstanceCreation classInstanceCreation2 = (ClassInstanceCreation) expression2;
- AnonymousClassDeclaration anonymousClassDeclaration2 = classInstanceCreation2.getAnonymousClassDeclaration();
- assertNotNull("No anonymous class declaration", anonymousClassDeclaration2);
- checkSourceRange(anonymousClassDeclaration2, "{}", source);
- assertNotNull("No anonymous class declaration", anonymousClassDeclaration);
- checkSourceRange(anonymousClassDeclaration, "{/*x*/}", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=54431
- */
- public void test0540() {
- char[] source =
- ("package test0540;\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- "class Test {\n" + //$NON-NLS-1$
- " public void foo(int arg) {\n" +//$NON-NLS-1$
- " assert true;\n" +//$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}").toCharArray(); //$NON-NLS-1$
- IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$
- Map options = project.getOptions(true);
- options.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- options.put(JavaScriptCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaScriptCore.VERSION_1_4);
- options.put(JavaScriptCore.COMPILER_COMPLIANCE, JavaScriptCore.VERSION_1_4);
- ASTNode result = runConversion(source, "Test.js", project, options, true); //$NON-NLS-1$
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("Problems found", 0, compilationUnit.getProblems().length);
- ASTNode node = getASTNode(compilationUnit, 0);
- assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong package", "test0540", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Not an interface", typeBinding.isClass()); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=56697
- */
- public void test0541() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0541", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- class Change14FieldAccessASTVisitor extends ASTVisitor {
- int counter;
- Change14FieldAccessASTVisitor() {
- counter = 0;
- }
- public void endVisit(QualifiedName qualifiedName) {
- IBinding i_binding = qualifiedName.getQualifier().resolveBinding();
- ITypeBinding type_binding = qualifiedName.getQualifier().resolveTypeBinding();
- if (i_binding == null || type_binding == null) {
- counter++;
- }
- }
- }
- Change14FieldAccessASTVisitor visitor = new Change14FieldAccessASTVisitor();
- unit.accept(visitor);
- assertEquals("Missing binding", 0, visitor.counter);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55004
- */
- public void test0542() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0542", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "STRING_FIELD", variableBinding.getName());
- Object constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", "Hello world!", constantValue);
- Expression initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "\"Hello world!\"", source);
-
- node = getASTNode(unit, 0, 1);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "BOOLEAN_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", new Boolean(true), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "true", source);
-
- node = getASTNode(unit, 0, 2);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "BYTE_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", new Byte((byte)1), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "1", source);
-
- node = getASTNode(unit, 0, 3);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "CHAR_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", new Character('{'), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "\'{\'", source);
-
- node = getASTNode(unit, 0, 4);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "DOUBLE_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", new Double("3.1415"), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "3.1415", source);
-
- node = getASTNode(unit, 0, 5);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "FLOAT_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", new Float("3.14159f"), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "3.14159f", source);
-
- node = getASTNode(unit, 0, 6);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "INT_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", Integer.valueOf("7fffffff", 16), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "Integer.MAX_VALUE", source);
-
- node = getASTNode(unit, 0, 7);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "LONG_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", new Long("34"), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "34L", source);
-
- node = getASTNode(unit, 0, 8);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "SHORT_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", new Short("130"), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "130", source);
-
- node = getASTNode(unit, 0, 9);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "int_field", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNull("Got a constant", constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "Integer.MAX_VALUE", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=58436
- */
- public void test0543() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0543", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- unit.accept(new GetKeyVisitor());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51500
- */
- public void test0544() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0544", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Not an abstract method", (methodDeclaration.getModifiers() & Modifier.ABSTRACT) != 0);
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertNotNull("No binding", methodBinding);
- assertTrue("Not an abstract method binding", (methodBinding.getModifiers() & Modifier.ABSTRACT) != 0);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=59843
- */
- public void test0545() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0545", "First.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong key", "Ltest0545/First$Test;", typeBinding.getKey());
-
- sourceUnit = getCompilationUnit("Converter", "src", "test0545", "Second.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- result = runConversion(sourceUnit, true);
- unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- node = getASTNode(unit, 0, 0);
- assertEquals("not a method declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- typeDeclaration = (TypeDeclaration) node;
- typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong key", "Ltest0545/Second$Test;", typeBinding.getKey());
-
- sourceUnit = getCompilationUnit("Converter", "src", "test0545", "Third.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- result = runConversion(sourceUnit, true);
- unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- node = getASTNode(unit, 0, 0);
- assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- typeDeclaration = (TypeDeclaration) node;
- typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong key", "Ltest0545/Third$Test;", typeBinding.getKey());
-
-
- sourceUnit = getCompilationUnit("Converter", "src", "test0545", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- result = runConversion(sourceUnit, true);
- unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- node = getASTNode(unit, 0);
- assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- typeDeclaration = (TypeDeclaration) node;
- typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong key", "Ltest0545/Test;", typeBinding.getKey());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=59848
- * @deprecated using deprecated code
- */
- public void test0546() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0546", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("not a variable declaration", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- ITypeBinding typeBinding = variableBinding.getType();
- assertTrue("An anonymous type binding", !typeBinding.isAnonymous());
- Expression initializer = fragment.getInitializer();
- assertEquals("not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, initializer.getNodeType()); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) initializer;
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- ITypeBinding typeBinding2 = anonymousClassDeclaration.resolveBinding();
- assertTrue("Not an anonymous type binding", typeBinding2.isAnonymous());
- ITypeBinding typeBinding3 = classInstanceCreation.resolveTypeBinding();
- assertTrue("Not an anonymous type binding", typeBinding3.isAnonymous());
- node = getASTNode(unit, 1, 0, 1);
- assertEquals("not a expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); //$NON-NLS-1$
- ExpressionStatement statement = (ExpressionStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType()); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertEquals("not a simple name", ASTNode.SIMPLE_NAME, expression2.getNodeType()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- ITypeBinding typeBinding4 = simpleName.resolveTypeBinding();
- assertTrue("An anonymous type binding", !typeBinding4.isAnonymous());
- Name name = classInstanceCreation.getName();
- IBinding binding = name.resolveBinding();
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind());
- ITypeBinding typeBinding5 = (ITypeBinding) binding;
- assertTrue("An anonymous type binding", !typeBinding5.isAnonymous());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=60078
- * @deprecated using deprecated code
- */
- public void test0547() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0547", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType()); //$NON-NLS-1$
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
- TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration();
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong key", "Ltest0547/A$74$Local;", typeBinding.getKey());
-
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("wrong size", 3, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertEquals("not a type declaration statement", ASTNode.TYPE_DECLARATION, bodyDeclaration.getNodeType()); //$NON-NLS-1$
- TypeDeclaration typeDeclaration2 = (TypeDeclaration) bodyDeclaration;
-
- typeBinding = typeDeclaration2.resolveBinding();
- assertEquals("Wrong key", "Ltest0547/A$100$LocalMember;", typeBinding.getKey());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=60581
- */
- public void test0548() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0548", "PaletteStackEditPart.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48502
- */
- public void test0549() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0549", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48502
- */
- public void test0550() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0550", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, false);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=60848
- */
- public void test0551() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0551", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, false);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 1, problems.length); //$NON-NLS-1$
- IProblem problem = problems[0];
- assertEquals("wrong end position", source.length - 1, problem.getSourceEnd());
- }
-
- public void test0552() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0552", "Test.js");
- char[] source = sourceUnit.getSource().toCharArray();
- JavaScriptUnit result = (JavaScriptUnit) runConversion(sourceUnit, true);
- assertEquals("Got errors", 0, result.getProblems().length);
- TypeDeclaration declaration = (TypeDeclaration) result.types().get(0);
- Block body = declaration.getMethods()[0].getBody();
- ExpressionStatement expr = (ExpressionStatement) body.statements().get(0);
- FunctionInvocation invocation = (FunctionInvocation) expr.getExpression();
- InfixExpression node = (InfixExpression) invocation.arguments().get(0);
- ITypeBinding typeBinding = node.resolveTypeBinding();
- assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName());
- checkSourceRange(node, "\"a\" + \"a\" + \"a\"", source);
- List extendedOperands = node.extendedOperands();
- assertEquals("Wrong size", 1, extendedOperands.size());
- Expression leftOperand = node.getLeftOperand();
- checkSourceRange(leftOperand, "\"a\"", source);
- typeBinding = leftOperand.resolveTypeBinding();
- assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName());
- Expression rightOperand = node.getRightOperand();
- checkSourceRange(rightOperand, "\"a\"", source);
- typeBinding = rightOperand.resolveTypeBinding();
- assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName());
- Expression expression = (Expression) extendedOperands.get(0);
- checkSourceRange(expression, "\"a\"", source);
- typeBinding = expression.resolveTypeBinding();
- assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61946
- */
- public void test0553() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0553", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- Object constantValue = variableBinding.getConstantValue();
- assertNull("Got a constant value", constantValue);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61946
- */
- public void test0554() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0554", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- checkSourceRange(expression2, "A", source);
- ITypeBinding typeBinding = expression2.resolveTypeBinding();
- assertEquals("wrong type", "test0554.A", typeBinding.getQualifiedName());
- IVariableBinding[] fields = typeBinding.getDeclaredFields();
- assertEquals("Wrong size", 1, fields.length);
- IVariableBinding variableBinding = fields[0];
- Object constantValue = variableBinding.getConstantValue();
- assertNotNull("Missing constant", constantValue);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61946
- */
- public void test0555() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0555", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression.getNodeType());
- QualifiedName qualifiedName = (QualifiedName) expression;
- Name name = qualifiedName.getQualifier();
- checkSourceRange(name, "A", source);
- ITypeBinding typeBinding = name.resolveTypeBinding();
- assertEquals("wrong type", "test0555.A", typeBinding.getQualifiedName());
- IVariableBinding[] fields = typeBinding.getDeclaredFields();
- assertEquals("Wrong size", 1, fields.length);
- IVariableBinding variableBinding = fields[0];
- Object constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant value", constantValue);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=62463
- */
- public void test0556() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0556", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 1, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- checkSourceRange(expression2, "(aa.bar())", source);
- SimpleName simpleName = methodInvocation.getName();
- checkSourceRange(simpleName, "size", source);
- checkSourceRange(expression, "(aa.bar()).size()", source);
- checkSourceRange(expressionStatement, "(aa.bar()).size();", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=62463
- */
- public void test0557() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0557", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 1, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- checkSourceRange(expression2, "(aa.bar())", source);
- SimpleName simpleName = methodInvocation.getName();
- checkSourceRange(simpleName, "get", source);
- checkSourceRange(expression, "(aa.bar()).get(0)", source);
- checkSourceRange(expressionStatement, "(aa.bar()).get(0);", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65090
- * @deprecated using deprecated code
- */
- public void test0558() {
- String src = "\tSystem.out.println(\"Hello\");\n\tSystem.out.println(\"World\");\n";
- char[] source = src.toCharArray();
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setKind (ASTParser.K_STATEMENTS);
- parser.setSource (source);
- ASTNode result = parser.createAST (null);
- assertNotNull("no result", result);
- assertEquals("Wrong type", ASTNode.BLOCK, result.getNodeType());
- Block block = (Block) result;
- List statements = block.statements();
- assertNotNull("No statements", statements);
- assertEquals("Wrong size", 2, statements.size());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
- */
- public void test0559() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0559", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
- Expression expression4 = parenthesizedExpression.getExpression();
- assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType());
- checkSourceRange(expression4, "\" \"", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
- */
- public void test0560() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0560", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
- Expression expression4 = parenthesizedExpression.getExpression();
- assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType());
- checkSourceRange(expression4, "\" \"", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
- */
- public void test0561() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0561", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
- Expression expression4 = parenthesizedExpression.getExpression();
- assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType());
- checkSourceRange(expression4, "\" \"", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
- */
- public void test0562() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0562", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
- Expression expression4 = parenthesizedExpression.getExpression();
- assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType());
- checkSourceRange(expression4, "\" \"", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
- */
- public void test0563() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0563", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
- Expression expression4 = parenthesizedExpression.getExpression();
- checkSourceRange(expression4, "new String()", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
- */
- public void test0564() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0564", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
- Expression expression4 = parenthesizedExpression.getExpression();
- checkSourceRange(expression4, "new String()", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
- */
- public void test0565() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0565", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
- Expression expression4 = parenthesizedExpression.getExpression();
- checkSourceRange(expression4, "(/**/ String /**/) new String()", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=69349
- */
- public void test0566() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0566", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- assertEquals("Wrong character", '}', source[node.getStartPosition() + node.getLength() - 1]);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=69349
- */
- public void test0567() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0567", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- assertEquals("Wrong character", '}', source[node.getStartPosition() + node.getLength() - 1]);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=74369
- * @deprecated using deprecated code
- */
- public void test0569() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0569", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 1);
- assertEquals("not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType()); //$NON-NLS-1$
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
- TypeDeclaration typeDeclaration = typeDeclarationStatement.getTypeDeclaration();
- assertEquals("wrong name", "Local", typeDeclaration.getName().getIdentifier());
- assertNull("Got a javadoc", typeDeclaration.getJavadoc());
- node = getASTNode(unit, 0);
- assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- typeDeclaration = (TypeDeclaration) node;
- assertEquals("wrong name", "A", typeDeclaration.getName().getIdentifier());
- assertNotNull("No javadoc", typeDeclaration.getJavadoc());
- node = getASTNode(unit, 0, 0);
- assertEquals("not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "method", methodDeclaration.getName().getIdentifier());
- assertNotNull("No javadoc", methodDeclaration.getJavadoc());
- }
-
- /*
- * Ensures that the type binding from an import and the type binding from a type ref are equals
- * when the AST is computed using IJavaScriptUnit#reconcile(...)
- * (regression test for bug 83210 Unidentical ITypeBindings for same type from same AST from reconcile)
- */
- public void test0570() throws CoreException {
- IJavaScriptUnit workingCopy = null;
- try {
- workingCopy = getWorkingCopy("/Converter/src/X.js", true);
- JavaScriptUnit unit = (JavaScriptUnit) buildAST(
- "import java.util.List;\n" +
- "public class X{\n" +
- " List field;\n" +
- "}",
- workingCopy
- );
- ImportDeclaration importDeclaration = (ImportDeclaration) unit.imports().iterator().next();
- TypeDeclaration typeDeclaration = (TypeDeclaration) unit.types().iterator().next();
- FieldDeclaration fieldDeclaration = typeDeclaration.getFields()[0];
- Type type = fieldDeclaration.getType();
- IBinding importBinding = importDeclaration.resolveBinding();
- IBinding typeBinding = type.resolveBinding();
- assertEquals(importBinding,typeBinding);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * Ensures that the bindings for a member type in a .class file can be created.
- */
- public void test0571() throws CoreException, IOException {
- try {
- IJavaScriptProject p = createJavaProject("P", new String[] {""}, new String[] {"CONVERTER_JCL_LIB"});
- String source =
- "public class X {\n" +
- " public class Y {\n" +
- " }\n" +
- "}";
- addLibrary(p, "test0571.jar", "test0571.zip", new String[] {"X.js", source }, "1.4");
- IClassFile classFile = getClassFile("P", "/P/test0571.jar", "", "X$Y.class");
- JavaScriptUnit unit = (JavaScriptUnit) runConversion(AST.JLS3, classFile, 0, true);
- IProblem[] problems = unit.getProblems();
- StringBuffer buffer = new StringBuffer();
- for (int i = 0, length = problems.length; i < length; i++)
- Util.appendProblem(buffer, problems[i], source.toCharArray(), i);
- assertEquals("Unexpected problems", "", buffer.toString());
- } finally {
- deleteProject("P");
- }
- }
-
- /*
- * Ensures that the method bindings of an anonymous type are correct.
- */
- public void test0572() throws CoreException {
- IJavaScriptUnit workingCopy = null;
- try {
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- AnonymousClassDeclaration type = (AnonymousClassDeclaration) buildAST(
- "public class X {\n" +
- " void foo() {\n" +
- " new X() /*start*/{\n" +
- " void bar() {}\n" +
- " }/*end*/;\n" +
- " }\n" +
- "}",
- workingCopy);
- ITypeBinding typeBinding = type.resolveBinding();
- assertBindingsEqual(
- "LX$40;.(LX;)V\n" +
- "LX$40;.bar()V",
- typeBinding.getDeclaredMethods());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * Ensures that the Java element of a compilation is correct.
- */
- public void test0573() throws CoreException {
- IJavaScriptUnit workingCopy = null;
- try {
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- JavaScriptUnit cu = (JavaScriptUnit) buildAST(
- "public class X {\n" +
- "}",
- workingCopy);
- assertElementEquals("Unexpected Java element", "[Working copy] X.java [in <default> [in src [in Converter]]]", cu.getJavaElement());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
- /*
- * Ensures that strings are not optimized when creating the AST through a reconcile.
- * (regression test for bug 82830 AST: String concatenation represented as single node)
- */
- public void test0574() throws CoreException {
- IJavaScriptUnit workingCopy = null;
- try {
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode string = buildAST(
- "public class X {\n" +
- " String s = /*start*/\"a\" + \"b\"/*end*/;\n" +
- "}",
- workingCopy);
- assertEquals("Unexpected node type", ASTNode.INFIX_EXPRESSION, string.getNodeType());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * Ensures that 2 different method bindings with the same return type are not "isEqualTo(...)".
- * (regression test for bug 99978 MalformedTreeException on Inline Method)
- */
- public void test0575() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " /*start1*/String foo(String o) {return null;}/*end1*/\n" +
- " /*start2*/String foo(Object o) {return null;}/*end2*/\n" +
- "}";
- IBinding[] firstBatch = resolveBindings(contents, workingCopy);
- IBinding[] secondBatch = resolveBindings(contents, workingCopy);
- assertTrue("2 different method type bindings should not be equals", !firstBatch[0].isEqualTo(secondBatch[1]));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * Ensures that the binding key of a raw member type is correct.
- * (regression test for bug 100549 Strange binding keys from AST on class file of nested type)
- */
- public void test0576() throws CoreException, IOException {
- try {
- IJavaScriptProject project = createJavaProject("P1", new String[] {""}, new String[] {"CONVERTER_JCL15_LIB"}, "", "1.5");
- addLibrary(project, "lib.jar", "src.zip", new String[] {
- "/P1/p/X.js",
- "package p;\n" +
- "public class X<T> {\n" +
- " /*start*/public class Member {\n" +
- " }/*end*/\n" +
- "}",
- }, "1.5");
- IClassFile classFile = getClassFile("P1", "/P1/lib.jar", "p", "X$Member.class");
- String source = classFile.getSource();
- MarkerInfo markerInfo = new MarkerInfo(source);
- markerInfo.astStarts = new int[] {source.indexOf("/*start*/") + "/*start*/".length()};
- markerInfo.astEnds = new int[] {source.indexOf("/*end*/")};
- ASTNode node = buildAST(markerInfo, classFile);
- ITypeBinding binding = ((TypeDeclaration) node).resolveBinding();
- assertBindingKeyEquals("Lp/X<TT;>.Member;", binding.getKey());
- } finally {
- deleteProject("P1");
- }
- }
-
- /*
- * Ensures that strings are not optimized when creating the AST through a reconcile
- * even if the working copy was consistent.
- * (regression test for bug 114909 AST: String concatenation represented as single node)
- */
- public void test0577() throws CoreException {
- IJavaScriptUnit workingCopy = null;
- try {
- workingCopy = getWorkingCopy(
- "/Converter/src/X.js",
- "public class X {\n" +
- " String s = /*start*/\"a\" + \"b\"/*end*/;\n" +
- "}",
- true/*resolve*/);
- ASTNode string = buildAST(workingCopy);
- assertEquals("Unexpected node type", ASTNode.INFIX_EXPRESSION, string.getNodeType());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
-
-
- /*
- * Ensures that the start position of an argument that has a previous sibbling with a comment is correct
- * (regression test for bug 80904 Quick Fix "Assign parameter to new field" doesn't appear with commented type)
- */
- public void test0579() throws CoreException {
- IJavaScriptUnit workingCopy = null;
- try {
- workingCopy = getWorkingCopy(
- "/Converter/src/X.js",
- "public class X {\n" +
- " /*start*/void foo(Object/*first arg*/ arg1, Object arg2) {\n" +
- " }/*end*/\n" +
- "}",
- true/*resolve*/);
- FunctionDeclaration method = (FunctionDeclaration) buildAST(workingCopy);
- SingleVariableDeclaration arg2 = (SingleVariableDeclaration) method.parameters().get(1);
- int start = arg2.getStartPosition();
- assertEquals("Unexpected range for arg2", "Object arg2", workingCopy.getSource().substring(start, start+arg2.getLength()));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- public void test0606() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0606", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertProblemsSize(unit, 0);
- unit.accept(new ASTVisitor() {
- public boolean visit(FunctionDeclaration methodDeclaration) {
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- IJavaScriptElement javaElement = methodBinding.getJavaElement();
- assertNotNull("No java element", javaElement);
- return false;
- }
- });
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=173853
- */
- public void test0607() throws CoreException {
- IJavaScriptUnit workingCopy = null;
- try {
- workingCopy = getWorkingCopy(
- "/Converter/src/X.js",
- "public class X {\n" +
- " void foo() {\n" +
- " #\n" +
- " /*start*/new Object() {\n" +
- " }/*end*/;\n" +
- " }\n" +
- "}",
- true/*resolve*/);
- ASTNode string = buildAST(null, workingCopy, true, true);
- assertEquals("Unexpected node type", ASTNode.CLASS_INSTANCE_CREATION, string.getNodeType());
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) string;
- ITypeBinding resolveTypeBinding = classInstanceCreation.resolveTypeBinding();
- assertNotNull("Binding is null", resolveTypeBinding);
- IFunctionBinding[] declaredMethods = resolveTypeBinding.getDeclaredMethods();
- assertNotNull("Should have one method", declaredMethods);
- assertEquals("Should have one method", 1, declaredMethods.length);
- assertTrue("The method should be a default constructor", declaredMethods[0].isDefaultConstructor());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTestAST3_2.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTestAST3_2.java
deleted file mode 100644
index db189c3..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterTestAST3_2.java
+++ /dev/null
@@ -1,8652 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.util.ArrayList;
-import java.util.Hashtable;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.wst.jsdt.core.IClassFile;
-import org.eclipse.wst.jsdt.core.IFunction;
-import org.eclipse.wst.jsdt.core.IInitializer;
-import org.eclipse.wst.jsdt.core.IJavaScriptElement;
-import org.eclipse.wst.jsdt.core.IJavaScriptProject;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.ISourceRange;
-import org.eclipse.wst.jsdt.core.IType;
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.WorkingCopyOwner;
-import org.eclipse.wst.jsdt.core.compiler.IProblem;
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTMatcher;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.ASTParser;
-import org.eclipse.wst.jsdt.core.dom.ASTRequestor;
-import org.eclipse.wst.jsdt.core.dom.ASTVisitor;
-import org.eclipse.wst.jsdt.core.dom.AbstractTypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ArrayInitializer;
-import org.eclipse.wst.jsdt.core.dom.ArrayType;
-import org.eclipse.wst.jsdt.core.dom.Assignment;
-import org.eclipse.wst.jsdt.core.dom.Block;
-import org.eclipse.wst.jsdt.core.dom.BodyDeclaration;
-import org.eclipse.wst.jsdt.core.dom.CatchClause;
-import org.eclipse.wst.jsdt.core.dom.CharacterLiteral;
-import org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation;
-import org.eclipse.wst.jsdt.core.dom.ConstructorInvocation;
-import org.eclipse.wst.jsdt.core.dom.Expression;
-import org.eclipse.wst.jsdt.core.dom.ExpressionStatement;
-import org.eclipse.wst.jsdt.core.dom.FieldAccess;
-import org.eclipse.wst.jsdt.core.dom.FieldDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ForStatement;
-import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
-import org.eclipse.wst.jsdt.core.dom.IBinding;
-import org.eclipse.wst.jsdt.core.dom.IFunctionBinding;
-import org.eclipse.wst.jsdt.core.dom.ITypeBinding;
-import org.eclipse.wst.jsdt.core.dom.IVariableBinding;
-import org.eclipse.wst.jsdt.core.dom.IfStatement;
-import org.eclipse.wst.jsdt.core.dom.ImportDeclaration;
-import org.eclipse.wst.jsdt.core.dom.InfixExpression;
-import org.eclipse.wst.jsdt.core.dom.Initializer;
-import org.eclipse.wst.jsdt.core.dom.InstanceofExpression;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.Modifier;
-import org.eclipse.wst.jsdt.core.dom.Name;
-import org.eclipse.wst.jsdt.core.dom.NullLiteral;
-import org.eclipse.wst.jsdt.core.dom.PackageDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ParenthesizedExpression;
-import org.eclipse.wst.jsdt.core.dom.PrimitiveType;
-import org.eclipse.wst.jsdt.core.dom.QualifiedName;
-import org.eclipse.wst.jsdt.core.dom.ReturnStatement;
-import org.eclipse.wst.jsdt.core.dom.SimpleName;
-import org.eclipse.wst.jsdt.core.dom.SimpleType;
-import org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.wst.jsdt.core.dom.Statement;
-import org.eclipse.wst.jsdt.core.dom.StringLiteral;
-import org.eclipse.wst.jsdt.core.dom.SuperFieldAccess;
-import org.eclipse.wst.jsdt.core.dom.SuperMethodInvocation;
-import org.eclipse.wst.jsdt.core.dom.SwitchCase;
-import org.eclipse.wst.jsdt.core.dom.SwitchStatement;
-import org.eclipse.wst.jsdt.core.dom.TryStatement;
-import org.eclipse.wst.jsdt.core.dom.Type;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.WhileStatement;
-import org.eclipse.wst.jsdt.core.tests.model.CancelCounter;
-import org.eclipse.wst.jsdt.core.tests.model.Canceler;
-import org.eclipse.wst.jsdt.core.tests.model.ReconcilerTests;
-import org.eclipse.wst.jsdt.core.tests.util.Util;
-
-public class ASTConverterTestAST3_2 extends ConverterTestSetup {
-
- public void setUpSuite() throws Exception {
- super.setUpSuite();
- this.ast = AST.newAST(AST.JLS3);
- }
-
- public ASTConverterTestAST3_2(String name) {
- super(name);
- }
-
- static {
-// TESTS_NAMES = new String[] {"test0602"};
-// TESTS_RANGE = new int[] { 664, -1 };
-// TESTS_NUMBERS = new int[] { 664 };
- }
- public static Test suite() {
- return buildModelTestSuite(ASTConverterTestAST3_2.class);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=22560
- */
- public void test0401() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0401", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size()); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(0);
- assertTrue("Not a return statement", statement.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) statement;
- Expression expression = returnStatement.getExpression();
- assertNotNull("there is no expression", expression); //$NON-NLS-1$
- // call the default initialization
- methodDeclaration.getReturnType2();
- ITypeBinding typeBinding = expression.resolveTypeBinding();
- assertNotNull("No typebinding", typeBinding); //$NON-NLS-1$
- assertEquals("wrong name", "int", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23464
- */
- public void test0402() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0402", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 0);
- assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not a super method invocation", node.getNodeType() == ASTNode.SUPER_CONSTRUCTOR_INVOCATION); //$NON-NLS-1$
- checkSourceRange(node, "new A().super();", source); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597
- */
- public void test0403() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0403", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 1);
- assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "test", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IFunctionBinding methodBinding = (IFunctionBinding) binding2;
- assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- IFunctionBinding methodBinding2 = methodInvocation.resolveMethodBinding();
- assertNotNull("No method binding2", methodBinding2);
- assertTrue("Wrong binding", methodBinding == methodBinding2);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597
- */
- public void test0404() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0404", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IFunctionBinding methodBinding = (IFunctionBinding) binding2;
- assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597
- */
- public void test0405() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0405", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0, 1);
- assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IFunctionBinding methodBinding = (IFunctionBinding) binding2;
- assertEquals("Wrong name", "clone", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23597
- */
- public void test0406() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0406", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 1);
- assertEquals("Wrong number of problems", 1, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "foo", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IFunctionBinding methodBinding = (IFunctionBinding) binding2;
- assertEquals("Wrong name", "foo", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertNull("Got a declaring node in the unit", unit.findDeclaringNode(methodBinding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162
- */
- public void test0407() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0407", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- SimpleName simpleName = methodDeclaration.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("Not a method binding", binding.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IFunctionBinding methodBinding = (IFunctionBinding) binding;
- assertEquals("wrong name", "foo", methodBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- methodDeclaration.setName(methodDeclaration.getAST().newSimpleName("foo2")); //$NON-NLS-1$
- IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding();
- assertNotNull("No methodbinding2", methodBinding2); //$NON-NLS-1$
- assertEquals("wrong name", "foo", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- simpleName = methodDeclaration.getName();
- IBinding binding2 = simpleName.resolveBinding();
- assertNull("Got a binding2", binding2); //$NON-NLS-1$
-
- ASTNode astNode = unit.findDeclaringNode(methodBinding);
- assertNotNull("No declaring node", astNode);
- assertEquals("wrong declaring node", methodDeclaration, astNode);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162
- */
- public void test0408() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0408", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Type type = methodDeclaration.getReturnType2();
- assertTrue("Not a simple type", type.isSimpleType()); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("Not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) name;
- name = qualifiedName.getQualifier();
- assertTrue("Not a qualified name", name.isQualifiedName()); //$NON-NLS-1$
- qualifiedName = (QualifiedName) name;
- name = qualifiedName.getQualifier();
- assertTrue("Not a simple name", name.isSimpleName()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) name;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("Not a package binding", binding.getKind() == IBinding.PACKAGE); //$NON-NLS-1$
- assertEquals("Wrong name", "java", binding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=23162
- */
- public void test0409() throws JavaScriptModelException {
- Hashtable options = JavaScriptCore.getOptions();
- Hashtable newOptions = JavaScriptCore.getOptions();
- try {
- newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- JavaScriptCore.setOptions(newOptions);
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0409", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- BindingsCollectorVisitor bindingsCollectorVisitor = new BindingsCollectorVisitor();
- compilationUnit.accept(bindingsCollectorVisitor);
- assertEquals("wrong number", 3, bindingsCollectorVisitor.getUnresolvedNodesSet().size()); //$NON-NLS-1$
- Map bindingsMap = bindingsCollectorVisitor.getBindingsMap();
- assertEquals("wrong number", 211, bindingsMap.size()); //$NON-NLS-1$
- ASTNodesCollectorVisitor nodesCollector = new ASTNodesCollectorVisitor();
- compilationUnit.accept(nodesCollector);
- Set detachedNodes = nodesCollector.getDetachedAstNodes();
- int counter = 0;
- for (Iterator iterator = detachedNodes.iterator(); iterator.hasNext(); ) {
- ASTNode detachedNode = (ASTNode) iterator.next();
- counter++;
- IBinding binding = (IBinding) bindingsMap.get(detachedNode);
- assertNotNull(binding);
- switch(detachedNode.getNodeType()) {
- case ASTNode.ARRAY_ACCESS :
- case ASTNode.ARRAY_CREATION :
- case ASTNode.ARRAY_INITIALIZER :
- case ASTNode.ASSIGNMENT :
- case ASTNode.BOOLEAN_LITERAL :
- case ASTNode.CHARACTER_LITERAL :
- case ASTNode.CLASS_INSTANCE_CREATION :
- case ASTNode.CONDITIONAL_EXPRESSION :
- case ASTNode.FIELD_ACCESS :
- case ASTNode.INFIX_EXPRESSION :
- case ASTNode.INSTANCEOF_EXPRESSION :
- case ASTNode.FUNCTION_INVOCATION :
- case ASTNode.NULL_LITERAL :
- case ASTNode.NUMBER_LITERAL :
- case ASTNode.POSTFIX_EXPRESSION :
- case ASTNode.PREFIX_EXPRESSION :
- case ASTNode.THIS_EXPRESSION :
- case ASTNode.TYPE_LITERAL :
- case ASTNode.VARIABLE_DECLARATION_EXPRESSION :
- ITypeBinding typeBinding = ((Expression) detachedNode).resolveTypeBinding();
- if (!binding.equals(typeBinding)) {
- System.out.println(detachedNode);
- }
- assertTrue("binding not equals", binding.equals(typeBinding)); //$NON-NLS-1$
- break;
- case ASTNode.VARIABLE_DECLARATION_FRAGMENT :
- assertTrue("binding not equals", binding.equals(((VariableDeclarationFragment) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.ANONYMOUS_CLASS_DECLARATION :
- assertTrue("binding not equals", binding.equals(((AnonymousClassDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.QUALIFIED_NAME :
- case ASTNode.SIMPLE_NAME :
- IBinding newBinding = ((Name) detachedNode).resolveBinding();
- assertTrue("binding not equals", binding.equals(newBinding)); //$NON-NLS-1$
- break;
- case ASTNode.ARRAY_TYPE :
- case ASTNode.SIMPLE_TYPE :
- case ASTNode.PRIMITIVE_TYPE :
- assertTrue("binding not equals", binding.equals(((Type) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.CONSTRUCTOR_INVOCATION :
- assertTrue("binding not equals", binding.equals(((ConstructorInvocation) detachedNode).resolveConstructorBinding())); //$NON-NLS-1$
- break;
- case ASTNode.IMPORT_DECLARATION :
- assertTrue("binding not equals", binding.equals(((ImportDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.FUNCTION_DECLARATION :
- assertTrue("binding not equals", binding.equals(((FunctionDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.PACKAGE_DECLARATION :
- assertTrue("binding not equals", binding.equals(((PackageDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- case ASTNode.TYPE_DECLARATION :
- assertTrue("binding not equals", binding.equals(((TypeDeclaration) detachedNode).resolveBinding())); //$NON-NLS-1$
- break;
- }
- }
- } finally {
- JavaScriptCore.setOptions(options);
- }
- }
-
- /**
- * Test for message on jdt-core-dev
- */
- public void test0410() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0410", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- Expression expression = ((ReturnStatement) node).getExpression();
- assertTrue("Not an infix expression", expression.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expression;
- List extendedOperands = infixExpression.extendedOperands();
- assertEquals("wrong size", 3, extendedOperands.size()); //$NON-NLS-1$
- }
-
- /**
- * Test for message on jdt-core-dev
- */
- public void test0411() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0411", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("Wrong number of problems", 0, ((JavaScriptUnit) result).getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertNotNull(node);
- assertTrue("Not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- Expression expression = ((ReturnStatement) node).getExpression();
- assertTrue("Not an infix expression", expression.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expression;
- List extendedOperands = infixExpression.extendedOperands();
- assertEquals("wrong size", 0, extendedOperands.size()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23901
- */
- public void test0412() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0412", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0);
- assertNotNull(node);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertNotNull("No declaring node", unit.findDeclaringNode(typeBinding)); //$NON-NLS-1$
- Name name = typeDeclaration.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- ASTNode declaringNode = unit.findDeclaringNode(binding);
- assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$
- assertEquals("Wrong node", typeDeclaration, declaringNode); //$NON-NLS-1$
- typeBinding = name.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- declaringNode = unit.findDeclaringNode(typeBinding);
- assertNotNull("No declaring node", declaringNode); //$NON-NLS-1$
- assertEquals("Wrong node", typeDeclaration, declaringNode); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=20881
- */
- public void test0413() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0413", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 1, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List throwsException = methodDeclaration.thrownExceptions();
- assertEquals("wrong size", 2, throwsException.size()); //$NON-NLS-1$
- Name name = (Name) throwsException.get(0);
- IBinding binding = name.resolveBinding();
- assertNull("Got a binding", binding); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=23734
- */
- public void test0414() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0414", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Type type = methodDeclaration.getReturnType2();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- ASTNode declaringNode = unit.findDeclaringNode(typeBinding);
- assertNull("Got a declaring node", declaringNode); //$NON-NLS-1$
-
- node = getASTNode(unit, 0, 1);
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration2 = (FunctionDeclaration) node;
- Type type2 = methodDeclaration2.getReturnType2();
- ITypeBinding typeBinding2 = type2.resolveBinding();
- assertNotNull("No type binding", typeBinding2); //$NON-NLS-1$
- ASTNode declaringNode2 = unit.findDeclaringNode(typeBinding2);
- assertNotNull("No declaring node", declaringNode2); //$NON-NLS-1$
-
- IJavaScriptUnit sourceUnit2 = getCompilationUnit("Converter" , "src", "test0414", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- result = runConversion(AST.JLS3, sourceUnit2, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit2 = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit2.getProblems().length); //$NON-NLS-1$
- ASTNode declaringNode3 = unit2.findDeclaringNode(typeBinding);
- assertNull("Got a declaring node", declaringNode3); //$NON-NLS-1$
-
- ASTNode declaringNode4 = unit2.findDeclaringNode(typeBinding.getKey());
- assertNotNull("No declaring node", declaringNode4); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24268
- */
- public void test0415() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0415", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a switch statement", node.getNodeType() == ASTNode.SWITCH_STATEMENT); //$NON-NLS-1$
- SwitchStatement switchStatement = (SwitchStatement) node;
- List statements = switchStatement.statements();
- assertEquals("wrong size", statements.size(), 5); //$NON-NLS-1$
- Statement statement = (Statement) statements.get(3);
- assertTrue("not a switch case (default)", statement.getNodeType() == ASTNode.SWITCH_CASE); //$NON-NLS-1$
- SwitchCase defaultCase = (SwitchCase) statement;
- assertTrue("not a default case", defaultCase.isDefault());
- checkSourceRange(defaultCase, "default:", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24324
- */
- public void test0416() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0416", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", fragments.size(), 1);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression init = fragment.getInitializer();
- assertTrue("not a qualified name", init.getNodeType() == ASTNode.QUALIFIED_NAME); //$NON-NLS-1$
- QualifiedName qualifiedName = (QualifiedName) init;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("Wrong name", "CONST", simpleName.getIdentifier());
- IBinding binding = simpleName.resolveBinding();
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind());
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong modifier", variableBinding.getModifiers(), Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL);
- ASTNode declaringNode = unit.findDeclaringNode(variableBinding);
- assertNotNull("No declaring node", declaringNode);
- assertTrue("not a variable declaration fragment", declaringNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT);
- VariableDeclarationFragment variableDeclarationFragment = (VariableDeclarationFragment) declaringNode;
- FieldDeclaration fieldDeclaration = (FieldDeclaration) variableDeclarationFragment.getParent();
- assertEquals("Wrong modifier", fieldDeclaration.getModifiers(), Modifier.NONE);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24347
- */
- public void test0417() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0417", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertTrue("not a simple type", type.getNodeType() == ASTNode.SIMPLE_TYPE); //$NON-NLS-1$
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertTrue("Not a qualified name", name.isQualifiedName());
- QualifiedName qualifiedName = (QualifiedName) name;
- Name qualifier = qualifiedName.getQualifier();
- assertTrue("Not a simple name", qualifier.isSimpleName());
- IBinding binding = qualifier.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24406
- */
- public void test0418() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0418", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 1, 0);
- assertNotNull("No node", node);
- assertTrue("not an expression statement ", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("not an method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Name name = methodInvocation.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0419() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0419", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT);
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a name", expression2.getNodeType(), ASTNode.SIMPLE_NAME);
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNull(binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0420() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0420", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getRightOperand();
- assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION);
- checkSourceRange(expression2, "(2 + 3)", source);
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2;
- Expression expression3 = parenthesizedExpression.getExpression();
- checkSourceRange(expression3, "2 + 3", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0421() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0421", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "(1 + 2) + 3", source);
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION);
- checkSourceRange(expression2, "(1 + 2)", source);
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2;
- Expression expression3 = parenthesizedExpression.getExpression();
- checkSourceRange(expression3, "1 + 2", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0422() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0422", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "( 1 + 2 ) + 3", source);
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION);
- checkSourceRange(expression2, "( 1 + 2 )", source);
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2;
- Expression expression3 = parenthesizedExpression.getExpression();
- checkSourceRange(expression3, "1 + 2", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0423() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0423", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getRightOperand();
- assertEquals("Not a parenthesized expression", expression2.getNodeType(), ASTNode.PARENTHESIZED_EXPRESSION);
- checkSourceRange(expression2, "( 2 + 3 )", source);
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression2;
- Expression expression3 = parenthesizedExpression.getExpression();
- checkSourceRange(expression3, "2 + 3", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0424() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0424", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- assertEquals("Wrong size", 1, infixExpression.extendedOperands().size());
- Expression expression2 = (Expression) infixExpression.extendedOperands().get(0);
- checkSourceRange(expression2, "( 2 + 3 )", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24453
- */
- public void test0425() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0425", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", expression.getNodeType(), ASTNode.INFIX_EXPRESSION);
- InfixExpression infixExpression = (InfixExpression) expression;
- assertEquals("Wrong size", 0, infixExpression.extendedOperands().size());
- Expression expression2 = infixExpression.getRightOperand();
- assertTrue("not an infix expression", expression2.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression2 = (InfixExpression) expression2;
- Expression expression3 = infixExpression2.getRightOperand();
- assertTrue("not a parenthesized expression", expression3.getNodeType() == ASTNode.PARENTHESIZED_EXPRESSION); //$NON-NLS-1$
- checkSourceRange(expression3, "( 2 + 3 )", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0426() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0426", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not a variable declaration statement", node.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertTrue("not a simple type", type.getNodeType() == ASTNode.SIMPLE_TYPE);
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertNotNull("No name", name);
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0427() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0427", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT);
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a super field access", expression2.getNodeType(), ASTNode.SUPER_FIELD_ACCESS);
- SuperFieldAccess superFieldAccess = (SuperFieldAccess) expression2;
- Name name = superFieldAccess.getName();
- assertNotNull("No name", name);
- IBinding binding = name.resolveBinding();
- assertNull("Got a binding", binding);
- assertNull("Got a binding", superFieldAccess.resolveFieldBinding());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0428() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0428", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT);
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a qualified name", expression2.getNodeType(), ASTNode.QUALIFIED_NAME);
- QualifiedName name = (QualifiedName) expression2;
- SimpleName simpleName = name.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- IBinding binding2 = name.resolveBinding();
- assertNotNull("No binding2", binding2);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24449
- */
- public void test0429() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0429", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", expression.getNodeType(), ASTNode.ASSIGNMENT);
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a qualified name", expression2.getNodeType(), ASTNode.QUALIFIED_NAME);
- QualifiedName name = (QualifiedName) expression2;
- SimpleName simpleName = name.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- IBinding binding2 = name.resolveBinding();
- assertNotNull("No binding2", binding2);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24499
- */
- public void test0430() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0430", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertTrue("Not a constructor invocation", node.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION);
- ConstructorInvocation constructorInvocation = (ConstructorInvocation) node;
- checkSourceRange(constructorInvocation, "this(coo2());", source);
- List arguments = constructorInvocation.arguments();
- assertEquals("Wrong size", 1, arguments.size());
- Expression expression = (Expression) arguments.get(0);
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION);
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- SimpleName simpleName = methodInvocation.getName();
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24500
- */
- public void test0431() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0431", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertTrue("Not a constructor invocation", node.getNodeType() == ASTNode.CONSTRUCTOR_INVOCATION);
- ConstructorInvocation constructorInvocation = (ConstructorInvocation) node;
- List arguments = constructorInvocation.arguments();
- assertEquals("Wrong size", 1, arguments.size());
- Expression expression = (Expression) arguments.get(0);
- assertTrue("Not a simple name", expression.getNodeType() == ASTNode.SIMPLE_NAME);
- SimpleName simpleName = (SimpleName) expression;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501
- */
- public void test0432() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0432", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType());
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, expression2.getNodeType());
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501
- */
- public void test0433() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0433", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType());
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a super field access", ASTNode.SUPER_FIELD_ACCESS, expression2.getNodeType());
- SuperFieldAccess superFieldAccess = (SuperFieldAccess) expression2;
- SimpleName simpleName = superFieldAccess.getName();
- assertEquals("wrong name", "fCoo", simpleName.getIdentifier());
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong binding", IBinding.VARIABLE, binding.getKind());
- IVariableBinding variableBinding = superFieldAccess.resolveFieldBinding();
- assertTrue("Different binding", binding == variableBinding);
- ASTNode astNode = unit.findDeclaringNode(variableBinding);
- assertTrue("Wrong type", astNode.getNodeType() == ASTNode.SINGLE_VARIABLE_DECLARATION || astNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT || astNode.getNodeType() == ASTNode.VARIABLE_DECLARATION_EXPRESSION);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501
- */
- public void test0434() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0434", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType());
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression2.getNodeType());
- QualifiedName qualifiedName = (QualifiedName) expression2;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("wrong name", "fCoo", simpleName.getIdentifier());
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24501
- */
- public void test0435() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0435", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType());
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getLeftHandSide();
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression2.getNodeType());
- QualifiedName qualifiedName = (QualifiedName) expression2;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("wrong name", "fCoo", simpleName.getIdentifier());
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502
- */
- public void test0436() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0436", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertProblemsSize(unit, 1, "The type A.CInner is not visible"); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType());
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, name.getNodeType());
- QualifiedName qualifiedName = (QualifiedName) name;
- SimpleName simpleName = qualifiedName.getName();
- assertEquals("wrong name", "CInner", simpleName.getIdentifier());
- IBinding binding2 = simpleName.resolveBinding();
- assertNotNull("No binding", binding2);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502
- */
- public void test0437() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0437", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertProblemsSize(unit, 1, "The type CInner is not visible"); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType());
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType());
- SimpleName simpleName = (SimpleName) name;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24511
- */
- public void test0438() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0438", "D.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- List imports = unit.imports();
- assertEquals("Wrong size", 1, imports.size()); //$NON-NLS-1$<
- ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0);
- IBinding binding = importDeclaration.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24502
- */
- public void test0439() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0439", "E.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- Type type = statement.getType();
- assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType());
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622
- */
- public void test0440() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0440", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- // 2 * 3 + "" + (true)
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "2 * 3 + \"\" + (true)", source);
- Expression leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "2 * 3 + \"\"", source);
- checkSourceRange(infixExpression.getRightOperand(), "(true)", source);
- assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.PLUS);
- assertEquals("wrong type", ASTNode.INFIX_EXPRESSION, leftOperand.getNodeType());
- infixExpression = (InfixExpression) leftOperand;
- checkSourceRange(infixExpression, "2 * 3 + \"\"", source);
- leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "2 * 3", source);
- checkSourceRange(infixExpression.getRightOperand(), "\"\"", source);
- assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.PLUS);
- assertEquals("wrong type", ASTNode.INFIX_EXPRESSION, leftOperand.getNodeType());
- infixExpression = (InfixExpression) leftOperand;
- checkSourceRange(infixExpression, "2 * 3", source);
- leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "2", source);
- checkSourceRange(infixExpression.getRightOperand(), "3", source);
- assertEquals("wrong operator", infixExpression.getOperator(), InfixExpression.Operator.TIMES);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622
- */
- public void test0441() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0441", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "(2 + 2) * 3 * 1", source);
- Expression leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "(2 + 2)", source);
- checkSourceRange(infixExpression.getRightOperand(), "3", source);
- List extendedOperands = infixExpression.extendedOperands();
- assertEquals("wrong size", 1, extendedOperands.size());
- checkSourceRange((Expression) extendedOperands.get(0), "1", source);
- assertEquals("wrong operator", InfixExpression.Operator.TIMES, infixExpression.getOperator());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24622
- */
- public void test0442() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0442", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- checkSourceRange(infixExpression, "2 + (2 * 3) + 1", source);
- Expression leftOperand = infixExpression.getLeftOperand();
- checkSourceRange(leftOperand, "2", source);
- Expression rightOperand = infixExpression.getRightOperand();
- checkSourceRange(rightOperand, "(2 * 3)", source);
- assertEquals("wrong type", ASTNode.PARENTHESIZED_EXPRESSION, rightOperand.getNodeType());
- List extendedOperands = infixExpression.extendedOperands();
- assertEquals("wrong size", 1, extendedOperands.size());
- checkSourceRange((Expression) extendedOperands.get(0), "1", source);
- assertEquals("wrong operator", InfixExpression.Operator.PLUS, infixExpression.getOperator());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24623
- */
- public void test0443() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0443", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertNotNull("No body", methodDeclaration.getBody());
- assertNotNull("No binding", methodDeclaration.resolveBinding());
- assertTrue("Not an abstract method", Modifier.isAbstract(methodDeclaration.getModifiers()));
- List modifiers = methodDeclaration.modifiers();
- assertEquals("Wrong size", 2, modifiers.size());
- Modifier modifier1 = (Modifier) modifiers.get(0);
- assertTrue("Not a public modifier", modifier1.isPublic());
- Modifier modifier2 = (Modifier) modifiers.get(1);
- assertTrue("Not an abstract modifier", modifier2.isAbstract());
- assertTrue("Not malformed", isMalformed(methodDeclaration));
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24623
- */
- public void test0444() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0444", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0);
- assertEquals("Wrong type", ASTNode.TYPE_DECLARATION, node.getNodeType());
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 2, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(0);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- assertEquals("Wrong name", "foo", methodDeclaration.getName().getIdentifier());
- assertNull("Got a binding", methodDeclaration.resolveBinding());
- bodyDeclaration = (BodyDeclaration)bodyDeclarations.get(1);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType());
- assertEquals("Wrong name", "foo", ((FunctionDeclaration) bodyDeclaration).getName().getIdentifier());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24773
- */
- public void test0445() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0445", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25018
- */
- public void test0446() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0446", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$<
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25124
- */
- public void test0447() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0447", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 3, unit.getProblems().length); //$NON-NLS-1$<
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=25330
- */
- public void test0448() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0448", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", node.getNodeType(), ASTNode.FUNCTION_DECLARATION);
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Not a constructor", methodDeclaration.isConstructor());
- assertNull("No return type", methodDeclaration.getReturnType2());
- Block block = methodDeclaration.getBody();
- assertNotNull("No method body", block);
- assertEquals("wrong size", 0, block.statements().size());
- }
-
- /**
- * Check that the implicit super constructor call is not there
- */
- public void test0449() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0449", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", node.getNodeType(), ASTNode.FUNCTION_DECLARATION);
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Not a constructor", methodDeclaration.isConstructor());
- Block block = methodDeclaration.getBody();
- assertNotNull("No method body", block);
- assertEquals("wrong size", 1, block.statements().size());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=26452
- */
- public void test0450() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0450", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0);
- assertEquals("Not a type declaration", node.getNodeType(), ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- assertTrue("not a class", typeBinding.isClass());
- assertTrue("not a toplevel type", typeBinding.isTopLevel());
- assertTrue("a local type", !typeBinding.isLocal());
- assertTrue("an anonymous type", !typeBinding.isAnonymous());
- assertTrue("a member type", !typeBinding.isMember());
- assertTrue("a nested type", !typeBinding.isNested());
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not an expression statement", node.getNodeType(), ASTNode.EXPRESSION_STATEMENT);
- Expression expression = ((ExpressionStatement) node).getExpression();
- assertEquals("Not a class instance creation", expression.getNodeType(), ASTNode.CLASS_INSTANCE_CREATION);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- typeBinding = anonymousClassDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- assertTrue("not a class", typeBinding.isClass());
- assertTrue("a toplevel type", !typeBinding.isTopLevel());
- assertTrue("not a local type", typeBinding.isLocal());
- assertTrue("not an anonymous type", typeBinding.isAnonymous());
- assertTrue("a member type", !typeBinding.isMember());
- assertTrue("not a nested type", typeBinding.isNested());
- ASTNode astNode = unit.findDeclaringNode(typeBinding);
- assertEquals("Wrong type", ASTNode.ANONYMOUS_CLASS_DECLARATION, astNode.getNodeType());
- assertNotNull("Didn't get a key", typeBinding.getKey());
- astNode = unit.findDeclaringNode(typeBinding.getKey());
- assertNotNull("Didn't get a declaring node", astNode);
-
- ITypeBinding typeBinding3 = classInstanceCreation.resolveTypeBinding();
- assertEquals("wrong binding", typeBinding, typeBinding3);
-
- List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
- assertEquals("wrong size", 2, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("not a type declaration", bodyDeclaration.getNodeType() == ASTNode.TYPE_DECLARATION);
- typeDeclaration = (TypeDeclaration) bodyDeclaration;
-
- bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(1);
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- assertNotNull("No body", block);
- List statements = block.statements();
- assertEquals("wrong size", 2, statements.size());
- Statement statement = (Statement) statements.get(1);
- assertEquals("Not a variable declaration statement", statement.getNodeType(), ASTNode.VARIABLE_DECLARATION_STATEMENT);
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement;
- Type type = variableDeclarationStatement.getType();
- assertNotNull("No type", type);
-
- ITypeBinding typeBinding2 = type.resolveBinding();
- typeBinding = typeDeclaration.resolveBinding();
- assertTrue("not equals", typeBinding == typeBinding2);
- assertNotNull("No type binding", typeBinding);
- assertTrue("not a class", typeBinding.isClass());
- assertTrue("a toplevel type", !typeBinding.isTopLevel());
- assertTrue("an anonymous type", !typeBinding.isAnonymous());
- assertTrue("not a member type", typeBinding.isMember());
- assertTrue("not a nested type", typeBinding.isNested());
- assertTrue("a local type", !typeBinding.isLocal());
-
- bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("wrong size", 1, bodyDeclarations.size());
- bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("not a type declaration", bodyDeclaration.getNodeType() == ASTNode.TYPE_DECLARATION);
- typeDeclaration = (TypeDeclaration) bodyDeclaration;
- typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- assertTrue("not a class", typeBinding.isClass());
- assertTrue("a toplevel type", !typeBinding.isTopLevel());
- assertTrue("an anonymous type", !typeBinding.isAnonymous());
- assertTrue("not a member type", typeBinding.isMember());
- assertTrue("not a nested type", typeBinding.isNested());
- assertTrue("a local type", !typeBinding.isLocal());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=24916
- */
- public void test0451() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0451", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Type type = methodDeclaration.getReturnType2();
- checkSourceRange(type, "int", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=27204
- */
- public void test0452() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "NO_WORKING.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- SimpleName name = methodDeclaration.getName();
- assertEquals("wrong line number", 3, compilationUnit.getLineNumber(name.getStartPosition()));
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=27173
- */
- public void test0453() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0453", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0,0);
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertTrue("not a super method invocation", expression.getNodeType() == ASTNode.SUPER_METHOD_INVOCATION); //$NON-NLS-1$
- SuperMethodInvocation methodInvocation = (SuperMethodInvocation) expression;
- IFunctionBinding methodBinding = methodInvocation.resolveMethodBinding();
- assertNotNull("No method binding", methodBinding);
- assertEquals("Wrong binding", "toString", methodBinding.getName());
- }
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28296
- */
- public void test0454() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0454", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0,1);
- assertNotNull("No node", node);
- assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- checkSourceRange(expression, "(int) (3.14f * a)", source);
- }
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0455() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0455", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int i = 0; i < 10; i++) // for 1\n" +
- " for (int j = 0; j < 10; j++) // for 2\n" +
- " if (true) { }";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "for (int j = 0; j < 10; j++) // for 2\n" +
- " if (true) { }";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement2 = (ForStatement) body;
- body = forStatement2.getBody();
- expectedSource = "if (true) { }";
- checkSourceRange(body, expectedSource, source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0456() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0456", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int x= 10; x < 20; x++)\n" +
- " main();";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "main();";
- checkSourceRange(body, expectedSource, source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0457() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0457", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+
- " for (int z= 10; z < 10; z++)\n" +
- " foo();";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "for (int z= 10; z < 10; z++)\n" +
- " foo();";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement2 = (ForStatement) body;
- body = forStatement2.getBody();
- expectedSource = "foo();";
- checkSourceRange(body, expectedSource, source);
- }
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0458() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0458", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+
- " for (int z= 10; z < 10; z++)\n" +
- " ;";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "for (int z= 10; z < 10; z++)\n" +
- " ;";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement2 = (ForStatement) body;
- body = forStatement2.getBody();
- expectedSource = ";";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not an empty statement", body.getNodeType() == ASTNode.EMPTY_STATEMENT); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28682
- */
- public void test0459() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0459", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node; // first for loop
- String expectedSource = "for (int i= 10; i < 10; i++)/*[*/\n"+
- " for (int z= 10; z < 10; z++)\n" +
- " { }";
- checkSourceRange(forStatement, expectedSource, source);
- Statement body = forStatement.getBody();
- expectedSource = "for (int z= 10; z < 10; z++)\n" +
- " { }";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a for statement", body.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement2 = (ForStatement) body;
- body = forStatement2.getBody();
- expectedSource = "{ }";
- checkSourceRange(body, expectedSource, source);
- assertTrue("not a block", body.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28869
- */
- public void test0460() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0460", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("Malformed", !isMalformed(node));
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=28824
- */
- public void test0461() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0461", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- char[] source = sourceUnit.getSource().toCharArray();
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("Malformed", !isMalformed(node));
- assertTrue("not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("not an assignment", expression.getNodeType() == ASTNode.ASSIGNMENT); //$NON-NLS-1$
- Assignment assignment = (Assignment) expression;
- checkSourceRange(assignment, "z= foo().y.toList()", source);
- Expression expression2 = assignment.getRightHandSide();
- checkSourceRange(expression2, "foo().y.toList()", source);
- assertTrue("not a method invocation", expression2.getNodeType() == ASTNode.FUNCTION_INVOCATION);
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- checkSourceRange(expression3, "foo().y", source);
- checkSourceRange(methodInvocation.getName(), "toList", source);
- assertTrue("not a field access", expression3.getNodeType() == ASTNode.FIELD_ACCESS);
- FieldAccess fieldAccess = (FieldAccess) expression3;
- checkSourceRange(fieldAccess.getName(), "y", source);
- Expression expression4 = fieldAccess.getExpression();
- checkSourceRange(expression4, "foo()", source);
- assertTrue("not a method invocation", expression4.getNodeType() == ASTNode.FUNCTION_INVOCATION);
- FunctionInvocation methodInvocation2 = (FunctionInvocation) expression4;
- checkSourceRange(methodInvocation2.getName(), "foo", source);
- assertNull("no null", methodInvocation2.getExpression());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=32338
- */
- public void test0462() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "", "Test462.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertTrue("Has error", compilationUnit.getProblems().length == 0); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0);
- assertNotNull("No node", node);
- assertTrue("not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertEquals("Wrong name", "Test462", typeDeclaration.getName().getIdentifier());
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong name", "Test462", typeBinding.getQualifiedName());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33450
- */
- public void test0463() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0463", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertTrue("not a string literal", expression.getNodeType() == ASTNode.STRING_LITERAL); //$NON-NLS-1$
- StringLiteral stringLiteral = (StringLiteral) expression;
- checkSourceRange(stringLiteral, "\"\\012\\015\\u0061\"", source);
- assertEquals("wrong value", "\012\015a", stringLiteral.getLiteralValue());
- assertEquals("wrong value", "\"\\012\\015\\u0061\"", stringLiteral.getEscapedValue());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33039
- */
- public void test0464() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0464", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("No error", 1, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertTrue("not a null literal", expression.getNodeType() == ASTNode.NULL_LITERAL); //$NON-NLS-1$
- NullLiteral nullLiteral = (NullLiteral) expression;
- ITypeBinding typeBinding = nullLiteral.resolveTypeBinding();
- assertNotNull("No type binding", typeBinding);
- assertFalse("A primitive type", typeBinding.isPrimitive());
- assertTrue("Null type", typeBinding.isNullType());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33831
- */
- public void test0465() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0465", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertTrue("not a field access", expression.getNodeType() == ASTNode.FIELD_ACCESS); //$NON-NLS-1$
- FieldAccess fieldAccess = (FieldAccess) expression;
- Name name = fieldAccess.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind());
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "i", variableBinding.getName());
- assertEquals("Wrong type", "int", variableBinding.getType().getName());
- IVariableBinding variableBinding2 = fieldAccess.resolveFieldBinding();
- assertTrue("different binding", variableBinding == variableBinding2);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33949
- */
- public void test0466() throws JavaScriptModelException {
- Hashtable options = JavaScriptCore.getOptions();
- Hashtable newOptions = JavaScriptCore.getOptions();
- try {
- newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- JavaScriptCore.setOptions(newOptions);
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0466", "Assert.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- checkSourceRange(node, "assert ref != null : message;", source);
- } finally {
- JavaScriptCore.setOptions(options);
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=33949
- */
- public void test0467() throws JavaScriptModelException {
- Hashtable options = JavaScriptCore.getOptions();
- Hashtable newOptions = JavaScriptCore.getOptions();
- try {
- newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- JavaScriptCore.setOptions(newOptions);
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0467", "Assert.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- checkSourceRange(node, "assert ref != null : message\\u003B", source);
-
- node = getASTNode(compilationUnit, 0, 0, 1);
- checkSourceRange(node, "assert ref != null\\u003B", source);
- } finally {
- JavaScriptCore.setOptions(options);
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=36772
- */
- public void test0468() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0468", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a return statement", node.getNodeType() == ASTNode.RETURN_STATEMENT); //$NON-NLS-1$
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertTrue("not a field access", expression.getNodeType() == ASTNode.FIELD_ACCESS); //$NON-NLS-1$
- FieldAccess fieldAccess = (FieldAccess) expression;
- Name name = fieldAccess.getName();
- IBinding binding = name.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.VARIABLE, binding.getKind());
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "i", variableBinding.getName());
- assertEquals("Wrong type", "int", variableBinding.getType().getName());
- IVariableBinding variableBinding2 = fieldAccess.resolveFieldBinding();
- assertTrue("different binding", variableBinding == variableBinding2);
-
- node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("No node", node);
- assertEquals("Wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
-
- ASTNode foundNode = compilationUnit.findDeclaringNode(variableBinding);
- assertNotNull("No found node", foundNode);
- assertEquals("wrong node", fragment, foundNode);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=36895
- */
- public void test0469() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "codeManipulation", "bug.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 2, 0);
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a variable declaration statement", node.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- ASTNode parent = node.getParent();
- assertNotNull(parent);
- assertTrue("not a block", parent.getNodeType() == ASTNode.BLOCK); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=37381
- */
- public void test0470() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0470", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No node", node);
- assertTrue("not a for statement", node.getNodeType() == ASTNode.FOR_STATEMENT); //$NON-NLS-1$
- ForStatement forStatement = (ForStatement) node;
- List initializers = forStatement.initializers();
- assertEquals("wrong size", 1, initializers.size());
- Expression initializer = (Expression) initializers.get(0);
- assertTrue("not a variable declaration expression", initializer.getNodeType() == ASTNode.VARIABLE_DECLARATION_EXPRESSION); //$NON-NLS-1$
- VariableDeclarationExpression variableDeclarationExpression = (VariableDeclarationExpression) initializer;
- List fragments = variableDeclarationExpression.fragments();
- assertEquals("wrong size", 2, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- checkSourceRange(fragment, "i= 0", source);
- fragment = (VariableDeclarationFragment) fragments.get(1);
- checkSourceRange(fragment, "j= goo(3)", source);
- checkSourceRange(variableDeclarationExpression, "int i= 0, j= goo(3)", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=38447
- */
- public void test0471() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0471", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No error", 1, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Is a constructor", !methodDeclaration.isConstructor());
- checkSourceRange(methodDeclaration, "private void foo(){", source);
- node = getASTNode(compilationUnit, 0, 1);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Is a constructor", !methodDeclaration.isConstructor());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=38447
- */
- public void test0472() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "junit.textui", "ResultPrinter.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No error", 2, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 2);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Not a constructor", methodDeclaration.isConstructor());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=38732
- */
- public void test0473() throws JavaScriptModelException {
- Hashtable options = JavaScriptCore.getOptions();
- Hashtable newOptions = JavaScriptCore.getOptions();
- try {
- newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- newOptions.put(JavaScriptCore.COMPILER_PB_ASSERT_IDENTIFIER, JavaScriptCore.ERROR);
- JavaScriptCore.setOptions(newOptions);
-
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0473", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No error", 2, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 0, 0);
- assertNotNull("No node", node);
- } finally {
- JavaScriptCore.setOptions(options);
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39259
- */
- public void test0474() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0474", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertNotNull("No node", node);
- assertEquals("Not a while statement", node.getNodeType(), ASTNode.WHILE_STATEMENT);
- WhileStatement whileStatement = (WhileStatement) node;
- Statement statement = whileStatement.getBody();
- assertEquals("Not a while statement", statement.getNodeType(), ASTNode.WHILE_STATEMENT);
- WhileStatement whileStatement2 = (WhileStatement) statement;
- String expectedSource =
- "while(b())\n" +
- " foo();";
- checkSourceRange(whileStatement2, expectedSource, source);
- Statement statement2 = whileStatement2.getBody();
- checkSourceRange(statement2, "foo();", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39259
- */
- public void test0475() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0475", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertNotNull("No node", node);
- assertEquals("Not an if statement", node.getNodeType(), ASTNode.IF_STATEMENT);
- IfStatement statement = (IfStatement) node;
- Statement statement2 = statement.getThenStatement();
- assertEquals("Not an if statement", statement2.getNodeType(), ASTNode.IF_STATEMENT);
- IfStatement statement3 = (IfStatement) statement2;
- String expectedSource =
- "if(b())\n" +
- " foo();";
- checkSourceRange(statement3, expectedSource, source);
- Statement statement4 = statement3.getThenStatement();
- checkSourceRange(statement4, "foo();", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39259
- */
- public void test0476() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0476", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No error", 0, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertNotNull("No node", node);
- assertEquals("Not a for statement", node.getNodeType(), ASTNode.FOR_STATEMENT);
- ForStatement statement = (ForStatement) node;
- Statement statement2 = statement.getBody();
- assertEquals("Not a for statement", statement2.getNodeType(), ASTNode.FOR_STATEMENT);
- ForStatement statement3 = (ForStatement) statement2;
- String expectedSource =
- "for(;b();)\n" +
- " foo();";
- checkSourceRange(statement3, expectedSource, source);
- Statement statement4 = statement3.getBody();
- checkSourceRange(statement4, "foo();", source);
- }
-
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=39327
- */
- public void test0477() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0477", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("No error", 1, compilationUnit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(compilationUnit, 0, 1, 0);
- assertNotNull("No node", node);
-
- checkSourceRange(node, "this(undef());", source);
- assertEquals("Not a constructor invocation", node.getNodeType(), ASTNode.CONSTRUCTOR_INVOCATION);
- ConstructorInvocation constructorInvocation = (ConstructorInvocation) node;
- List arguments = constructorInvocation.arguments();
- assertEquals("Wrong size", 1, arguments.size());
- IFunctionBinding binding = constructorInvocation.resolveConstructorBinding();
- assertNotNull("No binding", binding);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0478() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0478", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 2, types.length);
- IType type = types[1];
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertNotNull(methodBinding);
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 2, statements.size());
- ASTNode node2 = (ASTNode) statements.get(1);
- assertNotNull(node2);
- assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IFunctionBinding methodBinding2 = (IFunctionBinding) binding2;
- assertEquals("Wrong name", "clone", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0479() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0479", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 2, types.length);
- IType type = types[1];
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 2, statements.size());
- ASTNode node2 = (ASTNode) statements.get(1);
- assertNotNull(node2);
- assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNull("No binding", binding); //$NON-NLS-1$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0480() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0480", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0481() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0481", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node2;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding();
- assertNotNull(typeBinding);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0482() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0482", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IType[] memberTypes = type.getTypes();
- assertNotNull(memberTypes);
- assertEquals("wrong size", 1, memberTypes.length);
- IType memberType = memberTypes[0];
- IFunction[] methods = memberType.getFunctions();
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node2;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding();
- assertNotNull(typeBinding);
- assertTrue(typeBinding.isAnonymous());
- assertEquals("Wrong name", "", typeBinding.getName());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0483() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0483", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IFunction[] methods = type.getFunctions();
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "A", methodDeclaration.getName().getIdentifier());
- assertTrue("Not a constructor", methodDeclaration.isConstructor());
- IBinding binding = methodDeclaration.getName().resolveBinding();
- assertNotNull(binding);
- assertEquals("Wrong type", IBinding.METHOD, binding.getKind());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node2;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding();
- assertNotNull(typeBinding);
- assertTrue(typeBinding.isAnonymous());
- assertEquals("Wrong name", "", typeBinding.getName());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0484() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0482", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IType[] memberTypes = type.getTypes();
- assertNotNull(memberTypes);
- assertEquals("wrong size", 1, memberTypes.length);
- IType memberType = memberTypes[0];
- ISourceRange sourceRange = memberType.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier());
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0485() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0482", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IType[] memberTypes = type.getTypes();
- assertNotNull(memberTypes);
- assertEquals("wrong size", 1, memberTypes.length);
- IType memberType = memberTypes[0];
- ISourceRange sourceRange = memberType.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier());
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0486() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0486", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IFunction[] methods = type.getFunctions();
- assertEquals("wrong size", 2, methods.length);
- IFunction method = methods[1];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 2);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 2, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0487() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0487", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IFunction[] methods = type.getFunctions();
- assertEquals("wrong size", 3, methods.length);
- IFunction method = methods[1];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 2, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 4);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Wrong name", "field", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- fragment = (VariableDeclarationFragment) fragments.get(0);
- expression = fragment.getInitializer();
- assertEquals("Wrong name", "i", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 2);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- Initializer initializer = (Initializer) node;
- assertEquals("Not static", Modifier.NONE, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 3);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- initializer = (Initializer) node;
- assertEquals("Not static", Modifier.STATIC, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 6);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=40474
- */
- public void test0488() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0488", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IInitializer[] initializers = type.getInitializers();
- assertEquals("wrong size", 2, initializers.length);
- IInitializer init = initializers[1];
- ISourceRange sourceRange = init.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 4);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Wrong name", "field", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- fragment = (VariableDeclarationFragment) fragments.get(0);
- expression = fragment.getInitializer();
- assertEquals("Wrong name", "i", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 2);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- Initializer initializer = (Initializer) node;
- assertEquals("Not static", Modifier.NONE, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 3);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- initializer = (Initializer) node;
- assertEquals("Not static", Modifier.STATIC, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 6);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
- }
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=40804
- */
- public void test0489() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0489", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertNull("Got a type binding", typeDeclaration.resolveBinding());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=40804
- */
- public void test0490() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0490", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42647
- */
- public void test0491() throws JavaScriptModelException {
- Hashtable options = JavaScriptCore.getOptions();
- Hashtable newOptions = JavaScriptCore.getOptions();
- try {
- newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- JavaScriptCore.setOptions(newOptions);
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0491", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- } finally {
- JavaScriptCore.setOptions(options);
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42647
- */
- public void test0492() throws JavaScriptModelException {
- Hashtable options = JavaScriptCore.getOptions();
- Hashtable newOptions = JavaScriptCore.getOptions();
- try {
- newOptions.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- JavaScriptCore.setOptions(newOptions);
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0492", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- } finally {
- JavaScriptCore.setOptions(options);
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839
- */
- public void test0493() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0493", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Class[][]", source);
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type componentType = arrayType.getComponentType();
- assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class[]", source);
- arrayType = (ArrayType) componentType;
- componentType = arrayType.getComponentType();
- assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839
- */
- public void test0494() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0494", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Class[][][]", source);
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type componentType = arrayType.getComponentType();
- assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class[][]", source);
- arrayType = (ArrayType) componentType;
- componentType = arrayType.getComponentType();
- assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class[]", source);
- arrayType = (ArrayType) componentType;
- componentType = arrayType.getComponentType();
- assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839
- */
- public void test0495() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0495", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Class[][]", source);
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type componentType = arrayType.getComponentType();
- assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class[]", source);
- arrayType = (ArrayType) componentType;
- componentType = arrayType.getComponentType();
- assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class", source);
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- assertEquals("wrong extra dimension", 1, fragment.getExtraDimensions());
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839
- */
- public void test0496() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0496", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Class[][][][]", source);
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type componentType = arrayType.getComponentType();
- assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class[][][]", source);
- arrayType = (ArrayType) componentType;
- componentType = arrayType.getComponentType();
- assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class[][]", source);
- arrayType = (ArrayType) componentType;
- componentType = arrayType.getComponentType();
- assertTrue("not an array type", componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class[]", source);
- arrayType = (ArrayType) componentType;
- componentType = arrayType.getComponentType();
- assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=42839
- */
- public void test0497() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0497", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$<
- ASTNode node = getASTNode(unit, 0, 0);
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- Type type = fieldDeclaration.getType();
- checkSourceRange(type, "Class[]", source);
- assertTrue("not an array type", type.isArrayType()); //$NON-NLS-1$
- ArrayType arrayType = (ArrayType) type;
- Type componentType = arrayType.getComponentType();
- assertTrue("is an array type", !componentType.isArrayType()); //$NON-NLS-1$
- checkSourceRange(componentType, "Class", source);
- }
-
- /**
- */
- public void test0498() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0498", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=45199
- */
- public void test0499() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0499", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 1);
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- Expression expression = ((ExpressionStatement) node).getExpression();
- assertTrue("Not an assignment", expression.getNodeType() == ASTNode.ASSIGNMENT); //$NON-NLS-1$
- Assignment assignment = (Assignment) expression;
- Expression expression2 = assignment.getRightHandSide();
- assertTrue("Not an infix expression", expression2.getNodeType() == ASTNode.INFIX_EXPRESSION); //$NON-NLS-1$
- InfixExpression infixExpression = (InfixExpression) expression2;
- Expression expression3 = infixExpression.getLeftOperand();
- assertTrue("Not a simple name", expression3.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- ITypeBinding binding = expression3.resolveTypeBinding();
- assertNotNull("No binding", binding);
- Expression expression4 = assignment.getLeftHandSide();
- assertTrue("Not a simple name", expression4.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- ITypeBinding binding2 = expression4.resolveTypeBinding();
- assertNotNull("No binding", binding2);
- assertTrue("Should be the same", binding == binding2);
- }
-
- /**
- * Test for bug 45436 fix.
- * When this bug happened, the first assertion was false (2 problems found).
- * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=45436">bug 45436</a>
- * @throws JavaScriptModelException
- */
- public void test0500() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0500", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IJavaScriptProject project = sourceUnit.getJavaScriptProject();
- Map originalOptions = project.getOptions(false);
- try {
- project.setOption(JavaScriptCore.COMPILER_PB_INVALID_JAVADOC, JavaScriptCore.ERROR);
- project.setOption(JavaScriptCore.COMPILER_PB_MISSING_JAVADOC_TAGS, JavaScriptCore.ERROR);
- project.setOption(JavaScriptCore.COMPILER_PB_MISSING_JAVADOC_COMMENTS, JavaScriptCore.ERROR);
- JavaScriptUnit result = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
- IProblem[] problems= result.getProblems();
- assertTrue(problems.length == 1);
- assertEquals("Invalid warning", "Javadoc: Missing tag for parameter a", problems[0].getMessage());
- } finally {
- project.setOptions(originalOptions);
- }
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46012
- */
- public void test0501() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0501", "JavaEditor.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertNotNull(result);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502a() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // 'i' in initializer
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement)getASTNode(unit, 0, 0, 0);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
- IVariableBinding localBinding = fragment.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A;#0#i", localBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502b() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // 'j' in 'then' block in initializer
- IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 0, 1);
- Block block = (Block)ifStatement.getThenStatement();
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) block.statements().get(0);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
- IVariableBinding localBinding = fragment.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A;#0#0#j", localBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502c() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // 'i' in 'foo()'
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement)getASTNode(unit, 0, 1, 0);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
- IVariableBinding localBinding = fragment.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A;.foo()V#i", localBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502d() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // 'j' in 'then' block in 'foo()'
- IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 1, 1);
- Block block = (Block)ifStatement.getThenStatement();
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) block.statements().get(0);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
- IVariableBinding localBinding = fragment.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A;.foo()V#0#j", localBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502e() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // 'j' in 'else' block in 'foo()'
- IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 1, 1);
- Block block = (Block)ifStatement.getElseStatement();
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) block.statements().get(0);
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) variableDeclarationStatement.fragments().get(0);
- IVariableBinding localBinding = fragment.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A;.foo()V#1#j", localBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502f() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // first 'new Object(){...}' in 'foo()'
- ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 2);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A$182;", typeBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502g() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // 'B' in 'foo()'
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 3);
- AbstractTypeDeclaration typeDeclaration = typeDeclarationStatement.getDeclaration();
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A$206$B;", typeBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502h() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // second 'new Object(){...}' in 'foo()'
- ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 4);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A$255;", typeBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502i() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // 'field' in 'B' in 'foo()'
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 3);
- AbstractTypeDeclaration abstractTypeDeclaration = typeDeclarationStatement.getDeclaration();
- assertEquals("Wrong type", abstractTypeDeclaration.getNodeType(), ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) abstractTypeDeclaration;
- FieldDeclaration fieldDeclaration = typeDeclaration.getFields()[0];
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fieldDeclaration.fragments().get(0);
- IVariableBinding fieldBinding = fragment.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A$206$B;.field)I", fieldBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46013
- */
- public void test0502j() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0502", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // 'bar()' in 'B' in 'foo()'
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 3);
- AbstractTypeDeclaration abstractTypeDeclaration = typeDeclarationStatement.getDeclaration();
- assertEquals("Wrong type", abstractTypeDeclaration.getNodeType(), ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) abstractTypeDeclaration;
- FunctionDeclaration methodDeclaration = typeDeclaration.getMethods()[0];
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertEquals("Unexpected key", "Ltest0502/A$206$B;.bar()V", methodBinding.getKey()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503a() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // top level type A
- TypeDeclaration type = (TypeDeclaration)getASTNode(unit, 0);
- ITypeBinding typeBinding = type.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503b() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // member type B in A
- TypeDeclaration type = (TypeDeclaration)getASTNode(unit, 0, 0);
- ITypeBinding typeBinding = type.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A$B", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503c() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // local type E in foo() in A
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) getASTNode(unit, 0, 1, 0);
- AbstractTypeDeclaration typeDeclaration = typeDeclarationStatement.getDeclaration();
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A$1$E", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503d() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // anonymous type new Object() {...} in foo() in A
- ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 1);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A$2", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503e() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // type F in anonymous type new Object() {...} in foo() in A
- ExpressionStatement expressionStatement = (ExpressionStatement) getASTNode(unit, 0, 1, 1);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- TypeDeclaration type = (TypeDeclaration) anonymousClassDeclaration.bodyDeclarations().get(0);
- ITypeBinding typeBinding = type.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A$2$F", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503f() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // local type C in bar() in B in A
- FunctionDeclaration method = (FunctionDeclaration) getASTNode(unit, 0, 0, 0);
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) method.getBody().statements().get(0);
- AbstractTypeDeclaration typeDeclaration = typeDeclarationStatement.getDeclaration();
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A$1$C", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503g() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // anonymous type new Object() {...} in bar() in B in A
- FunctionDeclaration method = (FunctionDeclaration) getASTNode(unit, 0, 0, 0);
- ExpressionStatement expressionStatement = (ExpressionStatement) method.getBody().statements().get(1);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- ITypeBinding typeBinding = anonymousClassDeclaration.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A$1", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503h() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // type D in anonymous type new Object() {...} in bar() in B in A
- FunctionDeclaration method = (FunctionDeclaration) getASTNode(unit, 0, 0, 0);
- ExpressionStatement expressionStatement = (ExpressionStatement) method.getBody().statements().get(1);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- TypeDeclaration type = (TypeDeclaration) anonymousClassDeclaration.bodyDeclarations().get(0);
- ITypeBinding typeBinding = type.resolveBinding();
- assertEquals("Unexpected binary name", "test0503.A$1$D", typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=46057
- */
- public void test0503i() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0503", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- JavaScriptUnit unit = (JavaScriptUnit)runConversion(AST.JLS3, sourceUnit, true);
-
- // unreachable type G in foo() in A
- IfStatement ifStatement = (IfStatement) getASTNode(unit, 0, 1, 2);
- Block block = (Block)ifStatement.getThenStatement();
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) block.statements().get(0);
- AbstractTypeDeclaration typeDeclaration = typeDeclarationStatement.getDeclaration();
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Unexpected binary name", null, typeBinding.getBinaryName()); //$NON-NLS-1$
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=47396
- */
- public void test0504() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0504", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 1, 0);
- assertNotNull(node);
- assertTrue("Not a constructor declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- assertTrue("A constructor", !declaration.isConstructor());
- checkSourceRange(declaration, "public method(final int parameter);", source);
- }
-
- /**
- * http://bugs.eclipse.org/bugs/show_bug.cgi?id=47396
- */
- public void test0505() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0505", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertTrue("not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 1, 0);
- assertNotNull(node);
- assertTrue("Not a constructor declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- assertTrue("A constructor", !declaration.isConstructor());
- checkSourceRange(declaration, "public method(final int parameter) { }", source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699
- */
- public void test0506() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0506", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertTrue("is default constructor", binding.isDefaultConstructor());
- assertNull("Has a declaring node", unit.findDeclaringNode(binding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699
- */
- public void test0507() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0507", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertTrue("is default constructor", binding.isDefaultConstructor());
- assertNull("Has a declaring node", unit.findDeclaringNode(binding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699
- */
- public void test0508() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0508", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 1, 0);
- assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertTrue("not a default constructor", !binding.isDefaultConstructor());
- assertNotNull("Has no declaring node", unit.findDeclaringNode(binding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699
- */
- public void test0509() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0509", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertTrue("not a default constructor", !binding.isDefaultConstructor());
- assertNull("Has a declaring node", unit.findDeclaringNode(binding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699
- */
- public void test0510() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0510", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertFalse("is default constructor", binding.isDefaultConstructor());
- assertNull("Has a declaring node", unit.findDeclaringNode(binding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=46699
- */
- public void test0511() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0511", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong number of problems", 0, (unit).getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- assertTrue("Not a class instance creation", expressionStatement.getExpression().getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expressionStatement.getExpression();
- IFunctionBinding binding = classInstanceCreation.resolveConstructorBinding();
- assertFalse("is default constructor", binding.isDefaultConstructor());
- assertNull("Has a declaring node", unit.findDeclaringNode(binding));
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=47326
- */
- public void test0512() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0512", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Wrong number of problems", 2, unit.getProblems().length); //$NON-NLS-1$
- assertNotNull(node);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- assertTrue("Not a constructor", declaration.isConstructor());
- checkSourceRange(declaration, "public A();", source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=49429
- */
- public void test0513() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0513", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- }
-
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48502
- */
- public void test0514() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0514", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=49204
- */
- public void test0515() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0515", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a if statement", node.getNodeType() == ASTNode.IF_STATEMENT);
- IfStatement ifStatement = (IfStatement) node;
- assertTrue("not an empty statement", ifStatement.getThenStatement().getNodeType() == ASTNode.EMPTY_STATEMENT);
- checkSourceRange(ifStatement.getThenStatement(), ";", source);
- Statement statement = ifStatement.getElseStatement();
- assertTrue("not a if statement", statement.getNodeType() == ASTNode.IF_STATEMENT);
- ifStatement = (IfStatement) statement;
- assertTrue("not an empty statement", ifStatement.getThenStatement().getNodeType() == ASTNode.EMPTY_STATEMENT);
- checkSourceRange(ifStatement.getThenStatement(), ";", source);
- Statement statement2 = ifStatement.getElseStatement();
- assertTrue("not an empty statement", statement2.getNodeType() == ASTNode.EMPTY_STATEMENT);
- checkSourceRange(statement2, ";", source);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- */
- public void test0516() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0516", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION);
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
- parser.setSource(source);
- parser.setSourceRange(declaration.getStartPosition(), declaration.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a type declaration", result2.getNodeType() == ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) result2;
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue(declaration.subtreeMatch(new ASTMatcher(), bodyDeclaration));
- ASTNode root = bodyDeclaration.getRoot();
- assertNotNull("No root", root);
- assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) root;
- assertEquals("wrong problem size", 0, compilationUnit.getProblems().length);
- assertNotNull("No comments", compilationUnit.getCommentList());
- assertEquals("Wrong size", 3, compilationUnit.getCommentList().size());
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- */
- public void test0517() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0517", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No comments", unit.getCommentList());
- assertEquals("Wrong size", 3, unit.getCommentList().size());
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION);
- FieldDeclaration declaration = (FieldDeclaration) node;
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
- parser.setSource(source);
- parser.setSourceRange(declaration.getStartPosition(), declaration.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a type declaration", result2.getNodeType() == ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) result2;
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue(declaration.subtreeMatch(new ASTMatcher(), bodyDeclaration));
- ASTNode root = bodyDeclaration.getRoot();
- assertNotNull("No root", root);
- assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) root;
- assertEquals("wrong problem size", 0, compilationUnit.getProblems().length);
- assertNotNull("No comments", compilationUnit.getCommentList());
- assertEquals("Wrong size", 2, compilationUnit.getCommentList().size());
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- */
- public void test0518() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0518", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not an initializer", node.getNodeType() == ASTNode.INITIALIZER);
- Initializer declaration = (Initializer) node;
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
- parser.setSource(source);
- parser.setSourceRange(declaration.getStartPosition(), declaration.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a type declaration", result2.getNodeType() == ASTNode.TYPE_DECLARATION);
- TypeDeclaration typeDeclaration = (TypeDeclaration) result2;
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue(declaration.subtreeMatch(new ASTMatcher(), bodyDeclaration));
- ASTNode root = bodyDeclaration.getRoot();
- assertNotNull("No root", root);
- assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) root;
- assertEquals("wrong problem size", 0, compilationUnit.getProblems().length);
- assertNotNull("No comments", compilationUnit.getCommentList());
- assertEquals("Wrong size", 3, compilationUnit.getCommentList().size());
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- */
- public void test0519() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0519", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No comments", unit.getCommentList());
- assertEquals("Wrong size", 2, unit.getCommentList().size());
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- ASTNode statement = node;
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind(ASTParser.K_STATEMENTS);
- parser.setSource(source);
- parser.setSourceRange(statement.getStartPosition(), statement.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a block", result2.getNodeType() == ASTNode.BLOCK);
- Block block = (Block) result2;
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size());
- Statement statement2 = (Statement) statements.get(0);
- assertTrue(statement.subtreeMatch(new ASTMatcher(), statement2));
- ASTNode root = statement2.getRoot();
- assertNotNull("No root", root);
- assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) root;
- assertEquals("wrong problem size", 0, compilationUnit.getProblems().length);
- assertNotNull("No comments", compilationUnit.getCommentList());
- assertEquals("Wrong size", 1, compilationUnit.getCommentList().size());
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- */
- public void test0520() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0520", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- assertNotNull("No comments", unit.getCommentList());
- assertEquals("Wrong size", 2, unit.getCommentList().size());
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a block", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind(ASTParser.K_EXPRESSION);
- parser.setSource(source);
- parser.setSourceRange(expression.getStartPosition(), expression.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a method invocation", result2.getNodeType() == ASTNode.FUNCTION_INVOCATION);
- assertTrue(expression.subtreeMatch(new ASTMatcher(), result2));
- ASTNode root = result2.getRoot();
- assertNotNull("No root", root);
- assertTrue("not a compilation unit", root.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) root;
- assertEquals("wrong problem size", 0, compilationUnit.getProblems().length);
- assertNotNull("No comments", compilationUnit.getCommentList());
- assertEquals("Wrong size", 1, compilationUnit.getCommentList().size());
- }
- /**
- * Ensure an OperationCanceledException is correcly thrown when progress monitor is canceled
- * @deprecated using deprecated code
- */
- public void test0521() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0521", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-
- // count the number of time isCanceled() is called when converting this source unit
- WorkingCopyOwner owner = new WorkingCopyOwner() {};
- CancelCounter counter = new CancelCounter();
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setSource(sourceUnit);
- parser.setResolveBindings(true);
- parser.setWorkingCopyOwner(owner);
- parser.createAST(counter);
-
- // throw an OperatonCanceledException at each point isCanceled() is called
- for (int i = 0; i < counter.count; i++) {
- boolean gotException = false;
- try {
- parser = ASTParser.newParser(AST.JLS2);
- parser.setSource(sourceUnit);
- parser.setResolveBindings(true);
- parser.setWorkingCopyOwner(owner);
- parser.createAST(new Canceler(i));
- } catch (OperationCanceledException e) {
- gotException = true;
- }
- assertTrue("Should get an OperationCanceledException (" + i + ")", gotException);
- }
-
- // last should not throw an OperationCanceledException
- parser = ASTParser.newParser(AST.JLS2);
- parser.setSource(sourceUnit);
- parser.setResolveBindings(true);
- parser.setWorkingCopyOwner(owner);
- parser.createAST(new Canceler(counter.count));
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0522() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0522", "Test.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- assertNotNull(type);
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 2, methods.length);
- IFunction method = methods[1];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertNotNull(methodBinding);
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 2, statements.size());
- ASTNode node2 = (ASTNode) statements.get(1);
- assertNotNull(node2);
- assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNotNull("No binding", binding); //$NON-NLS-1$
- assertTrue("wrong type", binding.getKind() == IBinding.VARIABLE); //$NON-NLS-1$
- IVariableBinding variableBinding = (IVariableBinding) binding;
- assertEquals("Wrong name", "a", variableBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- IBinding binding2 = simpleName2.resolveBinding();
- assertNotNull("no binding2", binding2); //$NON-NLS-1$
- assertTrue("Wrong type", binding2.getKind() == IBinding.METHOD); //$NON-NLS-1$
- IFunctionBinding methodBinding2 = (IFunctionBinding) binding2;
- assertEquals("Wrong name", "clone", methodBinding2.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0523() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0523", "Test.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- assertNotNull(type);
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 2, methods.length);
- IFunction method = methods[1];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 1, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 2, statements.size());
- ASTNode node2 = (ASTNode) statements.get(1);
- assertNotNull(node2);
- assertTrue("Not an expression statement", node2.getNodeType() == ASTNode.EXPRESSION_STATEMENT); //$NON-NLS-1$
- ExpressionStatement expressionStatement = (ExpressionStatement) node2;
- Expression expression = expressionStatement.getExpression();
- assertTrue("Not a method invocation", expression.getNodeType() == ASTNode.FUNCTION_INVOCATION); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertTrue("Not a simple name", expression2.getNodeType() == ASTNode.SIMPLE_NAME); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding = simpleName.resolveBinding();
- assertNull("No binding", binding); //$NON-NLS-1$
- SimpleName simpleName2 = methodInvocation.getName();
- assertEquals("Wrong name", "clone", simpleName2.getIdentifier()); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0524() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0524", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- assertNotNull(type);
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 2, methods.length);
- IFunction method = methods[1];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0525() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0525", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- assertNotNull(type);
- IFunction[] methods = type.getFunctions();
- assertNotNull(methods);
- assertEquals("wrong size", 2, methods.length);
- IFunction method = methods[1];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node2;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding();
- assertNotNull(typeBinding);
- }
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0526() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0526", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- assertNotNull(type);
- IType[] memberTypes = type.getTypes();
- assertNotNull(memberTypes);
- assertEquals("wrong size", 1, memberTypes.length);
- IType memberType = memberTypes[0];
- IFunction[] methods = memberType.getFunctions();
- assertEquals("wrong size", 2, methods.length);
- IFunction method = methods[1];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "test", methodDeclaration.getName().getIdentifier());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node2;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding();
- assertNotNull(typeBinding);
- assertTrue(typeBinding.isAnonymous());
- assertEquals("Wrong name", "", typeBinding.getName());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0527() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0527", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- assertNotNull(type);
- IFunction[] methods = type.getFunctions();
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertEquals("wrong name", "A", methodDeclaration.getName().getIdentifier());
- assertTrue("Not a constructor", methodDeclaration.isConstructor());
- IBinding binding = methodDeclaration.getName().resolveBinding();
- assertNotNull(binding);
- assertEquals("Wrong type", IBinding.METHOD, binding.getKind());
- List statements = ((FunctionDeclaration) node).getBody().statements();
- assertEquals("wrong size", 1, statements.size());
- ASTNode node2 = (ASTNode) statements.get(0);
- assertNotNull(node2);
- assertTrue("Not an variable declaration statement", node2.getNodeType() == ASTNode.VARIABLE_DECLARATION_STATEMENT); //$NON-NLS-1$
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node2;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertTrue("Not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- ITypeBinding typeBinding = classInstanceCreation.resolveTypeBinding();
- assertNotNull(typeBinding);
- assertTrue(typeBinding.isAnonymous());
- assertEquals("Wrong name", "", typeBinding.getName());
- }
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0528() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0528", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- IType[] memberTypes = type.getTypes();
- assertNotNull(memberTypes);
- assertEquals("wrong size", 1, memberTypes.length);
- IType memberType = memberTypes[0];
- ISourceRange sourceRange = memberType.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, true);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier());
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- }
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0529() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0529", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- IType[] memberTypes = type.getTypes();
- assertNotNull(memberTypes);
- assertEquals("wrong size", 1, memberTypes.length);
- IType memberType = memberTypes[0];
- ISourceRange sourceRange = memberType.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- assertEquals("wrong name", "B", typeDeclaration.getName().getIdentifier());
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertTrue("Not a method declaration", bodyDeclaration.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0530() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0530", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- IFunction[] methods = type.getFunctions();
- assertEquals("wrong size", 3, methods.length);
- IFunction method = methods[2];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 2);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 2, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
- }
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0531() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("Converter" , "bins", "test0531", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- IType type = classFile.getType();
- IFunction[] methods = type.getFunctions();
- assertEquals("wrong size", 5, methods.length);
- IFunction method = methods[3];
- ISourceRange sourceRange = method.getSourceRange();
- ASTNode result = runConversion(AST.JLS3, classFile, sourceRange.getOffset() + sourceRange.getLength() / 2, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 2, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 4);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Wrong name", "field", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- fragment = (VariableDeclarationFragment) fragments.get(0);
- expression = fragment.getInitializer();
- assertEquals("Wrong name", "i", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 2);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- Initializer initializer = (Initializer) node;
- assertEquals("Not static", Modifier.NONE, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 3);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- initializer = (Initializer) node;
- assertEquals("Not static", Modifier.STATIC, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 6);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48292
- */
- public void test0532() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0488", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertNotNull(types);
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IInitializer[] initializers = type.getInitializers();
- assertEquals("wrong size", 2, initializers.length);
- IInitializer init = initializers[1];
- ISourceRange sourceRange = init.getSourceRange();
- int position = sourceRange.getOffset() + sourceRange.getLength() / 2;
-
- IClassFile classFile = getClassFile("Converter" , "bins", "test0532", "A.class"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- assertNotNull(classFile);
- assertNotNull(classFile.getSource());
- type = classFile.getType();
- initializers = type.getInitializers();
- assertEquals("wrong size", 0, initializers.length);
- ASTNode result = runConversion(AST.JLS3, classFile, position, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT); //$NON-NLS-1$
-
- ASTNode node = getASTNode((JavaScriptUnit) result, 0, 5);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- Block block = methodDeclaration.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 4);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 0);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Wrong name", "field", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 1);
- assertTrue("Not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- fragment = (VariableDeclarationFragment) fragments.get(0);
- expression = fragment.getInitializer();
- assertEquals("Wrong name", "i", fragment.getName().getIdentifier());
- assertNotNull("No initializer", expression);
-
- node = getASTNode((JavaScriptUnit) result, 0, 2);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- Initializer initializer = (Initializer) node;
- assertEquals("Not static", Modifier.NONE, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 3);
- assertTrue("Not an initializer", node.getNodeType() == ASTNode.INITIALIZER); //$NON-NLS-1$
- initializer = (Initializer) node;
- assertEquals("Not static", Modifier.STATIC, initializer.getModifiers());
- block = initializer.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
-
- node = getASTNode((JavaScriptUnit) result, 0, 6);
- assertTrue("Not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION); //$NON-NLS-1$
- methodDeclaration = (FunctionDeclaration) node;
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 0, statements.size());
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- * @deprecated using deprecated code
- */
- public void test0533() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0533", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a method declaration", node.getNodeType() == ASTNode.FUNCTION_DECLARATION);
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
- parser.setSource(source);
- parser.setSourceRange(declaration.getStartPosition(), declaration.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a compilation unit", result2.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result2;
- assertEquals("wrong problem size", 1, compilationUnit.getProblems().length);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- * @deprecated using deprecated code
- */
- public void test0534() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0534", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION);
- FieldDeclaration declaration = (FieldDeclaration) node;
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
- parser.setSource(source);
- parser.setSourceRange(declaration.getStartPosition(), declaration.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a compilation unit", result2.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result2;
- assertEquals("wrong problem size", 1, compilationUnit.getProblems().length);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=48489
- * @deprecated using deprecated code
- */
- public void test0535() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0535", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("not an initializer", node.getNodeType() == ASTNode.INITIALIZER);
- Initializer declaration = (Initializer) node;
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
- parser.setSource(source);
- parser.setSourceRange(declaration.getStartPosition(), declaration.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a compilation unit", result2.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result2;
- assertEquals("wrong problem size", 1, compilationUnit.getProblems().length);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=47396
- */
- public void test0536() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0536", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertNotNull("No compilation unit", result);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=51089
- */
- public void test0537a() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0537", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertNotNull("No compilation unit", result);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=51089
- */
- public void test0537b() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0537", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertNotNull("No compilation unit", result);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=51089
- */
- public void test0537c() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0537", "C.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertNotNull("No compilation unit", result);
- }
- /**
- * Ensures that an AST can be created during reconcile.
- * @deprecated using deprecated code
- */
- public void test0538a() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- sourceUnit.becomeWorkingCopy(null);
- sourceUnit.getBuffer().setContents(
- "package test0538;\n" +
- "public class A {\n" +
- " int i;\n" +
- "}"
- );
- JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null);
- assertNotNull("No level 2 compilation unit", unit);
- assertEquals("Compilation unit has wrong AST level (2)", AST.JLS2, unit.getAST().apiLevel());
- // TODO improve test for AST.JLS3
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /*
- * Ensures that no AST is created during reconcile if not requested.
- */
- public void test0538b() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- sourceUnit.becomeWorkingCopy(null);
- sourceUnit.getBuffer().setContents(
- "package test0538;\n" +
- "public class A {\n" +
- " int i;\n" +
- "}"
- );
- JavaScriptUnit unit = sourceUnit.reconcile(0, false, null, null);
- assertNull("Unexpected compilation unit", unit);
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /**
- * Ensures that no AST is created during reconcile if consistent.
- */
- public void test0538c() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- sourceUnit.becomeWorkingCopy(null);
- JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null);
- assertNull("Unexpected compilation unit", unit);
- // TODO improve test for AST.JLS3
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /**
- * Ensures that bindings are created during reconcile if the problem requestor is active.
- */
- public void test0538d() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- sourceUnit.becomeWorkingCopy(null);
- sourceUnit.getBuffer().setContents(
- "package test0538;\n" +
- "public class A {\n" +
- " Object field;\n" +
- "}"
- );
- // TODO improve test for AST.JLS3
- JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null);
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertTrue("Not original", isOriginal(node));
- assertTrue("not a field declaration", node.getNodeType() == ASTNode.FIELD_DECLARATION);
- FieldDeclaration declaration = (FieldDeclaration) node;
- Type type = declaration.getType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- assertEquals("Wrong name", "Object", typeBinding.getName());
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /**
- * Ensures that bindings are created during reconcile if force problem detection is turned on.
- * @deprecated using deprecated code
- */
- public void test0538e() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor();
- sourceUnit.becomeWorkingCopy(null);
- // TODO improve test for AST.JLS3
- JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, true/*force pb detection*/, null, null);
- ASTNode node = getASTNode(unit, 0);
- assertNotNull("No node", node);
- assertTrue("not a type declaration", node.getNodeType() == ASTNode.TYPE_DECLARATION);
- TypeDeclaration declaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = declaration.resolveBinding();
- assertNotNull("No type binding", typeBinding);
- assertEquals("Wrong name", "A", typeBinding.getName());
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /**
- * Ensures that bindings are created during reconcile if force problem detection is turned on.
- * Case of a unit containing an anonymous type.
- * (regression test for bug 55102 NPE when using ICU.reconcile(GET_AST_TRUE, ...))
- * @deprecated using deprecated code
- */
- public void test0538f() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor();
- sourceUnit.becomeWorkingCopy(null);
- sourceUnit.getBuffer().setContents(
- "package test0538;\n" +
- "public class A {\n" +
- " void foo() {\n" +
- " new Object() {\n" +
- " void bar() {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}"
- );
- // TODO improve test for AST.JLS3
- JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, true/*force pb detection*/, null, null);
- ASTNode node = getASTNode(unit, 0);
- assertNotNull("No node", node);
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /**
- * Ensures that bindings are created during reconcile if force problem detection is turned on.
- * Case of a unit containing an anonymous type.
- * (regression test for bug 55102 NPE when using ICU.reconcile(GET_AST_TRUE, ...))
- * @deprecated using deprecated code
- */
- public void test0538g() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor();
- sourceUnit.becomeWorkingCopy(null);
- sourceUnit.getBuffer().setContents(
- "package test0538;\n" +
- "public class A {\n" +
- " void foo() {\n" +
- " new Object() {\n" +
- " void bar() {\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}"
- );
- sourceUnit.reconcile(IJavaScriptUnit.NO_AST, false/* don't force pb detection*/, null, null);
- // TODO improve test for AST.JLS3
- JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, true/*force pb detection*/, null, null);
- ASTNode node = getASTNode(unit, 0);
- assertNotNull("No node", node);
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /**
- * Ensures that asking for well known type doesn't throw a NPE if the problem requestor is not active.
- * (regression test for bug 64750 NPE in Java AST Creation - editing some random file)
- * @deprecated using deprecated code
- */
- public void test0538h() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0538", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- try {
- ReconcilerTests.ProblemRequestor pbRequestor = new ReconcilerTests.ProblemRequestor() {
- public boolean isActive() {
- return false;
- }
- };
- sourceUnit.becomeWorkingCopy(null);
- sourceUnit.getBuffer().setContents(
- "package test0538;\n" +
- "public class A {\n" +
- " Object field;\n" +
- "}"
- );
- // TODO improve test for AST.JLS3
- JavaScriptUnit unit = sourceUnit.reconcile(AST.JLS2, false, null, null);
- assertEquals("Unexpected well known type", null, unit.getAST().resolveWellKnownType("void"));
- } finally {
- sourceUnit.discardWorkingCopy();
- }
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=53477
- */
- public void test0539() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0539", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 1, 0);
- assertNotNull("No node", node);
- assertTrue("not an expression statement", node.getNodeType() == ASTNode.EXPRESSION_STATEMENT);
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertTrue("not a class instance creation", expression.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION);
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- checkSourceRange(classInstanceCreation, "new A(){}.new Inner(){/*x*/}", source);
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- Expression expression2 = classInstanceCreation.getExpression();
- assertTrue("not a class instance creation", expression2.getNodeType() == ASTNode.CLASS_INSTANCE_CREATION);
- ClassInstanceCreation classInstanceCreation2 = (ClassInstanceCreation) expression2;
- AnonymousClassDeclaration anonymousClassDeclaration2 = classInstanceCreation2.getAnonymousClassDeclaration();
- assertNotNull("No anonymous class declaration", anonymousClassDeclaration2);
- checkSourceRange(anonymousClassDeclaration2, "{}", source);
- assertNotNull("No anonymous class declaration", anonymousClassDeclaration);
- checkSourceRange(anonymousClassDeclaration, "{/*x*/}", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=54431
- */
- public void test0540() {
- char[] source =
- ("package test0540;\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- "class Test {\n" + //$NON-NLS-1$
- " public void foo(int arg) {\n" +//$NON-NLS-1$
- " assert true;\n" +//$NON-NLS-1$
- " }\n" + //$NON-NLS-1$
- "}").toCharArray(); //$NON-NLS-1$
- IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$
- Map options = project.getOptions(true);
- options.put(JavaScriptCore.COMPILER_SOURCE, JavaScriptCore.VERSION_1_4);
- options.put(JavaScriptCore.COMPILER_CODEGEN_TARGET_PLATFORM, JavaScriptCore.VERSION_1_4);
- options.put(JavaScriptCore.COMPILER_COMPLIANCE, JavaScriptCore.VERSION_1_4);
- ASTNode result = runConversion(AST.JLS3, source, "Test.js", project, options, true); //$NON-NLS-1$
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertEquals("Problems found", 0, compilationUnit.getProblems().length);
- ASTNode node = getASTNode(compilationUnit, 0);
- assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNotNull("No type binding", typeBinding); //$NON-NLS-1$
- assertEquals("Wrong name", "Test", typeBinding.getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertEquals("Wrong package", "test0540", typeBinding.getPackage().getName()); //$NON-NLS-1$ //$NON-NLS-2$
- assertTrue("Not an interface", typeBinding.isClass()); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=56697
- */
- public void test0541() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0541", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- class Change14FieldAccessASTVisitor extends ASTVisitor {
- int counter;
- Change14FieldAccessASTVisitor() {
- counter = 0;
- }
- public void endVisit(QualifiedName qualifiedName) {
- IBinding i_binding = qualifiedName.getQualifier().resolveBinding();
- ITypeBinding type_binding = qualifiedName.getQualifier().resolveTypeBinding();
- if (i_binding == null || type_binding == null) {
- counter++;
- }
- }
- }
- Change14FieldAccessASTVisitor visitor = new Change14FieldAccessASTVisitor();
- unit.accept(visitor);
- assertEquals("Missing binding", 0, visitor.counter);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=55004
- */
- public void test0542() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0542", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "STRING_FIELD", variableBinding.getName());
- Object constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", "Hello world!", constantValue);
- Expression initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "\"Hello world!\"", source);
-
- node = getASTNode(unit, 0, 1);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "BOOLEAN_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", new Boolean(true), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "true", source);
-
- node = getASTNode(unit, 0, 2);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "BYTE_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", new Byte((byte)1), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "1", source);
-
- node = getASTNode(unit, 0, 3);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "CHAR_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", new Character('{'), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "\'{\'", source);
-
- node = getASTNode(unit, 0, 4);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "DOUBLE_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", new Double("3.1415"), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "3.1415", source);
-
- node = getASTNode(unit, 0, 5);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "FLOAT_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", new Float("3.14159f"), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "3.14159f", source);
-
- node = getASTNode(unit, 0, 6);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "INT_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", Integer.valueOf("7fffffff", 16), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "Integer.MAX_VALUE", source);
-
- node = getASTNode(unit, 0, 7);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "LONG_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", new Long("34"), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "34L", source);
-
- node = getASTNode(unit, 0, 8);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "SHORT_FIELD", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant", constantValue);
- assertEquals("Wrong value", new Short("130"), constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "130", source);
-
- node = getASTNode(unit, 0, 9);
- assertTrue("not a field declaration", node instanceof FieldDeclaration); //$NON-NLS-1$
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "int_field", variableBinding.getName());
- constantValue = variableBinding.getConstantValue();
- assertNull("Got a constant", constantValue);
- initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- checkSourceRange(initializer, "Integer.MAX_VALUE", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=58436
- */
- public void test0543() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0543", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- unit.accept(new GetKeyVisitor());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=51500
- */
- public void test0544() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0544", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("Not an abstract method", (methodDeclaration.getModifiers() & Modifier.ABSTRACT) != 0);
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- assertNotNull("No binding", methodBinding);
- assertTrue("Not an abstract method binding", (methodBinding.getModifiers() & Modifier.ABSTRACT) != 0);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=59843
- */
- public void test0545() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0545", "First.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong key", "Ltest0545/First$Test;", typeBinding.getKey());
-
- sourceUnit = getCompilationUnit("Converter", "src", "test0545", "Second.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- result = runConversion(AST.JLS3, sourceUnit, true);
- unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- node = getASTNode(unit, 0, 0);
- assertEquals("not a method declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- typeDeclaration = (TypeDeclaration) node;
- typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong key", "Ltest0545/Second$Test;", typeBinding.getKey());
-
- sourceUnit = getCompilationUnit("Converter", "src", "test0545", "Third.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- result = runConversion(AST.JLS3, sourceUnit, true);
- unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- node = getASTNode(unit, 0, 0);
- assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- typeDeclaration = (TypeDeclaration) node;
- typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong key", "Ltest0545/Third$Test;", typeBinding.getKey());
-
-
- sourceUnit = getCompilationUnit("Converter", "src", "test0545", "Test.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- result = runConversion(AST.JLS3, sourceUnit, true);
- unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- node = getASTNode(unit, 0);
- assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- typeDeclaration = (TypeDeclaration) node;
- typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong key", "Ltest0545/Test;", typeBinding.getKey());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=59848
- */
- public void test0546() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0546", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 0, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 1, 0, 0);
- assertEquals("not a variable declaration", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType()); //$NON-NLS-1$
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) node;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- ITypeBinding typeBinding = variableBinding.getType();
- assertTrue("An anonymous type binding", !typeBinding.isAnonymous());
- Expression initializer = fragment.getInitializer();
- assertEquals("not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, initializer.getNodeType()); //$NON-NLS-1$
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) initializer;
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- ITypeBinding typeBinding2 = anonymousClassDeclaration.resolveBinding();
- assertTrue("Not an anonymous type binding", typeBinding2.isAnonymous());
- ITypeBinding typeBinding3 = classInstanceCreation.resolveTypeBinding();
- assertTrue("Not an anonymous type binding", typeBinding3.isAnonymous());
- node = getASTNode(unit, 1, 0, 1);
- assertEquals("not a expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType()); //$NON-NLS-1$
- ExpressionStatement statement = (ExpressionStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType()); //$NON-NLS-1$
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- assertEquals("not a simple name", ASTNode.SIMPLE_NAME, expression2.getNodeType()); //$NON-NLS-1$
- SimpleName simpleName = (SimpleName) expression2;
- ITypeBinding typeBinding4 = simpleName.resolveTypeBinding();
- assertTrue("An anonymous type binding", !typeBinding4.isAnonymous());
- Type type = classInstanceCreation.getType();
- IBinding binding = type.resolveBinding();
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind());
- ITypeBinding typeBinding5 = (ITypeBinding) binding;
- assertTrue("An anonymous type binding", !typeBinding5.isAnonymous());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=60078
- */
- public void test0547() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0547", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertEquals("Wrong number of problems", 1, unit.getProblems().length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType()); //$NON-NLS-1$
- TypeDeclarationStatement typeDeclarationStatement = (TypeDeclarationStatement) node;
- AbstractTypeDeclaration typeDeclaration = typeDeclarationStatement.getDeclaration();
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertEquals("Wrong key", "Ltest0547/A$74$Local;", typeBinding.getKey());
-
- List bodyDeclarations = typeDeclaration.bodyDeclarations();
- assertEquals("wrong size", 3, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertEquals("not a type declaration statement", ASTNode.TYPE_DECLARATION, bodyDeclaration.getNodeType()); //$NON-NLS-1$
- TypeDeclaration typeDeclaration2 = (TypeDeclaration) bodyDeclaration;
-
- typeBinding = typeDeclaration2.resolveBinding();
- assertEquals("Wrong key", "Ltest0547/A$100$LocalMember;", typeBinding.getKey());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=60581
- */
- public void test0548() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0548", "PaletteStackEditPart.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48502
- */
- public void test0549() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0549", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=48502
- */
- public void test0550() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0550", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=60848
- */
- public void test0551() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0551", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 1, problems.length); //$NON-NLS-1$
- IProblem problem = problems[0];
- assertEquals("wrong end position", source.length - 1, problem.getSourceEnd());
- }
-
- public void test0552() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0552", "Test.js");
- char[] source = sourceUnit.getSource().toCharArray();
- JavaScriptUnit result = (JavaScriptUnit) runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("Got errors", 0, result.getProblems().length);
- TypeDeclaration declaration = (TypeDeclaration) result.types().get(0);
- Block body = declaration.getMethods()[0].getBody();
- ExpressionStatement expr = (ExpressionStatement) body.statements().get(0);
- FunctionInvocation invocation = (FunctionInvocation) expr.getExpression();
- InfixExpression node = (InfixExpression) invocation.arguments().get(0);
- ITypeBinding typeBinding = node.resolveTypeBinding();
- assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName());
- checkSourceRange(node, "\"a\" + \"a\" + \"a\"", source);
- List extendedOperands = node.extendedOperands();
- assertEquals("Wrong size", 1, extendedOperands.size());
- Expression leftOperand = node.getLeftOperand();
- checkSourceRange(leftOperand, "\"a\"", source);
- typeBinding = leftOperand.resolveTypeBinding();
- assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName());
- Expression rightOperand = node.getRightOperand();
- checkSourceRange(rightOperand, "\"a\"", source);
- typeBinding = rightOperand.resolveTypeBinding();
- assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName());
- Expression expression = (Expression) extendedOperands.get(0);
- checkSourceRange(expression, "\"a\"", source);
- typeBinding = expression.resolveTypeBinding();
- assertEquals("wrong type", "java.lang.String", typeBinding.getQualifiedName());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61946
- */
- public void test0553() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0553", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- Object constantValue = variableBinding.getConstantValue();
- assertNull("Got a constant value", constantValue);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61946
- */
- public void test0554() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0554", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- checkSourceRange(expression2, "A", source);
- ITypeBinding typeBinding = expression2.resolveTypeBinding();
- assertEquals("wrong type", "test0554.A", typeBinding.getQualifiedName());
- IVariableBinding[] fields = typeBinding.getDeclaredFields();
- assertEquals("Wrong size", 1, fields.length);
- IVariableBinding variableBinding = fields[0];
- Object constantValue = variableBinding.getConstantValue();
- assertNotNull("Missing constant", constantValue);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=61946
- */
- public void test0555() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0555", "B.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement returnStatement = (ReturnStatement) node;
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression.getNodeType());
- QualifiedName qualifiedName = (QualifiedName) expression;
- Name name = qualifiedName.getQualifier();
- checkSourceRange(name, "A", source);
- ITypeBinding typeBinding = name.resolveTypeBinding();
- assertEquals("wrong type", "test0555.A", typeBinding.getQualifiedName());
- IVariableBinding[] fields = typeBinding.getDeclaredFields();
- assertEquals("Wrong size", 1, fields.length);
- IVariableBinding variableBinding = fields[0];
- Object constantValue = variableBinding.getConstantValue();
- assertNotNull("No constant value", constantValue);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=62463
- */
- public void test0556() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0556", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 1, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- checkSourceRange(expression2, "(aa.bar())", source);
- SimpleName simpleName = methodInvocation.getName();
- checkSourceRange(simpleName, "size", source);
- checkSourceRange(expression, "(aa.bar()).size()", source);
- checkSourceRange(expressionStatement, "(aa.bar()).size();", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=62463
- */
- public void test0557() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0557", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 1, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not an method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- Expression expression2 = methodInvocation.getExpression();
- checkSourceRange(expression2, "(aa.bar())", source);
- SimpleName simpleName = methodInvocation.getName();
- checkSourceRange(simpleName, "get", source);
- checkSourceRange(expression, "(aa.bar()).get(0)", source);
- checkSourceRange(expressionStatement, "(aa.bar()).get(0);", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65090
- * @deprecated using deprecated code
- */
- public void test0558() {
- String src = "\tSystem.out.println(\"Hello\");\n\tSystem.out.println(\"World\");\n";
- char[] source = src.toCharArray();
- ASTParser parser = ASTParser.newParser(AST.JLS2);
- parser.setKind (ASTParser.K_STATEMENTS);
- parser.setSource (source);
- ASTNode result = parser.createAST (null);
- assertNotNull("no result", result);
- assertEquals("Wrong type", ASTNode.BLOCK, result.getNodeType());
- Block block = (Block) result;
- List statements = block.statements();
- assertNotNull("No statements", statements);
- assertEquals("Wrong size", 2, statements.size());
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
- */
- public void test0559() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0559", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
- Expression expression4 = parenthesizedExpression.getExpression();
- assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType());
- checkSourceRange(expression4, "\" \"", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
- */
- public void test0560() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0560", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
- Expression expression4 = parenthesizedExpression.getExpression();
- assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType());
- checkSourceRange(expression4, "\" \"", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
- */
- public void test0561() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0561", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
- Expression expression4 = parenthesizedExpression.getExpression();
- assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType());
- checkSourceRange(expression4, "\" \"", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
- */
- public void test0562() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0562", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
- Expression expression4 = parenthesizedExpression.getExpression();
- assertEquals("Wrong type", ASTNode.STRING_LITERAL, expression4.getNodeType());
- checkSourceRange(expression4, "\" \"", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
- */
- public void test0563() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0563", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
- Expression expression4 = parenthesizedExpression.getExpression();
- checkSourceRange(expression4, "new String()", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
- */
- public void test0564() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0564", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
- Expression expression4 = parenthesizedExpression.getExpression();
- checkSourceRange(expression4, "new String()", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=65562
- */
- public void test0565() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0565", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertEquals("Wrong type", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Wrong type", ASTNode.INFIX_EXPRESSION, expression.getNodeType());
- InfixExpression infixExpression = (InfixExpression) expression;
- Expression expression2 = infixExpression.getLeftOperand();
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression2.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression2;
- Expression expression3 = methodInvocation.getExpression();
- assertEquals("Wrong type", ASTNode.PARENTHESIZED_EXPRESSION, expression3.getNodeType());
- ParenthesizedExpression parenthesizedExpression = (ParenthesizedExpression) expression3;
- Expression expression4 = parenthesizedExpression.getExpression();
- checkSourceRange(expression4, "(/**/ String /**/) new String()", source);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=69349
- */
- public void test0566() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0566", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- assertEquals("Wrong character", '}', source[node.getStartPosition() + node.getLength() - 1]);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=69349
- */
- public void test0567() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0567", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- assertEquals("Wrong character", '}', source[node.getStartPosition() + node.getLength() - 1]);
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=70398
- */
- public void test0568() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0568", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=70398
- */
- public void test0570() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0570", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- }
-
- /**
- * No binding when there is no unit name set
- */
- public void test0571() throws JavaScriptModelException {
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- String source = "public class A {public boolean foo() {}}";
- parser.setSource(source.toCharArray());
- parser.setProject(getJavaProject("Converter"));
- // no unit name parser.setUnitName("A");
- parser.setResolveBindings(true);
- ASTNode node = parser.createAST(null);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) node;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- }
-
- /**
- * No binding when there is no unit name set
- */
- public void test0572() throws JavaScriptModelException {
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- String source = "public class A {public boolean foo() {}}";
- parser.setSource(source.toCharArray());
- parser.setProject(getJavaProject("Converter"));
- parser.setUnitName("A");
- parser.setResolveBindings(true);
- ASTNode node = parser.createAST(null);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) node;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 1, problems.length); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=77968
- */
- public void test0573() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0573", "Z.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- String source = sourceUnit.getSource();
- int pos = source.indexOf("his.ba");
- ASTNode result = runConversion(AST.JLS3, sourceUnit, pos, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertNotNull("Missing node", node);
- assertEquals("Wrong type", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) node;
- Expression expression = expressionStatement.getExpression();
- assertNotNull("Missing node", expression);
- assertEquals("Wrong type", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 1, problems.length); //$NON-NLS-1$
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78735
- */
- public void test0574() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0574", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("Missing node", node);
- assertEquals("Wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- node = getASTNode(unit, 0, 1, 0);
- assertNotNull("Missing node", node);
- assertEquals("Wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType());
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding2 = fragment.resolveBinding();
- assertFalse("are Equals", variableBinding.isEqualTo(variableBinding2));
- }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78735
- */
- public void test0575() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0575", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- final IProblem[] problems = unit.getProblems();
- assertEquals("Wrong number of problems", 0, problems.length); //$NON-NLS-1$
- ASTNode node = getASTNode(unit, 0, 2);
- assertNotNull("Missing node", node);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
- node = getASTNode(unit, 0, 1, 1);
- assertNotNull("Missing node", node);
- assertEquals("Wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- methodDeclaration = (FunctionDeclaration) node;
- IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding();
- assertFalse("are Equals", methodBinding.isEqualTo(methodBinding2));
- }
-
-// /**
-// * https://bugs.eclipse.org/bugs/show_bug.cgi?id=78740
-// * @deprecated marked deprecated to suppress JDOM-related deprecation warnings
-// */
-// public void test0576() throws JavaScriptModelException {
-// org.eclipse.wst.jsdt.core.jdom.DOMFactory factory = new org.eclipse.wst.jsdt.core.jdom.DOMFactory();
-// org.eclipse.wst.jsdt.core.jdom.IDOMCompilationUnit domCompilationUnit = factory.createCompilationUnit(
-// "package x; /** @model */ interface X {}", "NAME");
-// org.eclipse.wst.jsdt.core.jdom.IDOMType domType = (org.eclipse.wst.jsdt.core.jdom.IDOMType) domCompilationUnit.getFirstChild().getNextNode();
-// assertTrue("Not an interface", Flags.isInterface(domType.getFlags()));
-// domType.getComment();
-// assertTrue("Not an interface", Flags.isInterface(domType.getFlags()));
-// }
-
- /**
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=77645
- */
- public void test0578() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0578", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertProblemsSize(unit, 0);
- unit.accept(new ASTVisitor() {
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration)
- */
- public boolean visit(SingleVariableDeclaration node) {
- IVariableBinding binding = node.resolveBinding();
- assertNotNull("No method", binding.getDeclaringMethod());
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment)
- */
- public boolean visit(VariableDeclarationFragment node) {
- IVariableBinding binding = node.resolveBinding();
- ASTNode parent = node.getParent();
- if (parent != null && binding != null) {
- final IFunctionBinding declaringMethod = binding.getDeclaringMethod();
- final String variableBindingName = binding.getName();
- switch(parent.getNodeType()) {
- case ASTNode.FIELD_DECLARATION :
- assertNull("Got a method", declaringMethod);
- break;
- default :
- if (variableBindingName.equals("var1")
- || variableBindingName.equals("var2")) {
- assertNull("Got a method", declaringMethod);
- } else {
- assertNotNull("No method", declaringMethod);
- String methodName = declaringMethod.getName();
- if (variableBindingName.equals("var4")) {
- assertEquals("Wrong method", "foo", methodName);
- } else if (variableBindingName.equals("var5")) {
- assertEquals("Wrong method", "foo2", methodName);
- } else if (variableBindingName.equals("var7")) {
- assertEquals("Wrong method", "foo3", methodName);
- } else if (variableBindingName.equals("var8")) {
- assertEquals("Wrong method", "X", methodName);
- } else if (variableBindingName.equals("var9")) {
- assertEquals("Wrong method", "bar3", methodName);
- } else if (variableBindingName.equals("var10")) {
- assertEquals("Wrong method", "bar3", methodName);
- } else if (variableBindingName.equals("var11")) {
- assertEquals("Wrong method", "X", methodName);
- }
- }
- }
- }
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#visit(org.eclipse.wst.jsdt.core.dom.FieldAccess)
- */
- public boolean visit(FieldAccess node) {
- IVariableBinding binding = node.resolveFieldBinding();
- assertNull("No method", binding.getDeclaringMethod());
- return false;
- }
- /* (non-Javadoc)
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.SuperFieldAccess)
- */
- public boolean visit(SuperFieldAccess node) {
- IVariableBinding binding = node.resolveFieldBinding();
- assertNull("No method", binding.getDeclaringMethod());
- return false;
- }
- });
- }
-
-// /**
-// * https://bugs.eclipse.org/bugs/show_bug.cgi?id=77984
-// * @deprecated
-// */
-// public void test0579() throws JavaScriptModelException {
-// IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0579", "ParserTask.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
-// ASTNode result = AST.parseCompilationUnit(sourceUnit, true);
-// assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
-// JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
-// ASTNode node = getASTNode(compilationUnit, 0);
-// assertEquals("not a type declaration", ASTNode.TYPE_DECLARATION, node.getNodeType()); //$NON-NLS-1$
-// TypeDeclaration typeDeclaration = (TypeDeclaration) node;
-// assertEquals("Wrong number of body declarations", 3, typeDeclaration.bodyDeclarations().size());
-// }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=79953
- */
- public void test0580() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- workingCopy = getWorkingCopy("/Converter/src/p/X.js", true/*resolve*/);
- String source = "package p;\n" +
- "public class X {\n" +
- " d String[][]tab;\n" +
- "}";
- ASTNode node = buildAST(
- source,
- workingCopy,
- false);
- assertEquals("wrong type", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("wrong type", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- checkSourceRange(fieldDeclaration, "d String[][]", source.toCharArray());
- Type type = fieldDeclaration.getType();
- assertTrue("Not a simple type", type.isSimpleType());
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- assertEquals("Wrong extended dimensions", 2, fragment.getExtraDimensions());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=80041
- */
- public void test0581() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- workingCopy = getWorkingCopy("/Converter/src/p/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- "package p;\n" +
- "public class X {\n" +
- " void m(Object obj) {}\n" +
- " void foo(Object obj) {}\n" +
- "}",
- workingCopy);
- assertEquals("wrong type", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- SingleVariableDeclaration variableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- IVariableBinding variableBinding = variableDeclaration.resolveBinding();
- node = getASTNode(compilationUnit, 0, 1);
- assertEquals("wrong type", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- methodDeclaration = (FunctionDeclaration) node;
- parameters = methodDeclaration.parameters();
- variableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- IVariableBinding variableBinding2 = variableDeclaration.resolveBinding();
- assertFalse("Bindings are equal", variableBinding.isEqualTo(variableBinding2));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=80338
- */
- // TODO (jerome) remove this test as it has nothing to do on ASTConverterTest and it is a dup of ExistenceTests#testMethodWithInvalidParameter()
- public void test0582() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0582", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IType[] types = sourceUnit.getTypes();
- assertEquals("wrong size", 1, types.length);
- IType type = types[0];
- IFunction[] methods = type.getFunctions();
- assertEquals("wrong size", 1, methods.length);
- IFunction method = methods[0];
- assertEquals("wrong number", 1, method.getNumberOfParameters());
- assertEquals("wrong signature", "([[I)[[[[[I", method.getSignature());
- assertEquals("wrong return type", "[[[[[I", method.getReturnType());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616
- */
- public void test0583() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " private char nextChar() {\n" +
- " return \'\\000\';\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals("Got problems", 0, compilationUnit.getProblems().length);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement statement = (ReturnStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType());
- CharacterLiteral literal = (CharacterLiteral) expression;
- assertEquals("Wrong character", '\000', literal.charValue());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616
- */
- public void test0584() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " private char nextChar() {\n" +
- " return \'\\u0020\';\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals("Got problems", 0, compilationUnit.getProblems().length);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement statement = (ReturnStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType());
- CharacterLiteral literal = (CharacterLiteral) expression;
- assertEquals("Wrong character", 32, literal.charValue());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616
- */
- public void test0585() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " private char nextChar() {\n" +
- " return \'\\b\';\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals("Got problems", 0, compilationUnit.getProblems().length);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement statement = (ReturnStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType());
- CharacterLiteral literal = (CharacterLiteral) expression;
- assertEquals("Wrong character", '\b', literal.charValue());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616
- */
- public void test0586() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " private char nextChar() {\n" +
- " return \'\\t\';\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals("Got problems", 0, compilationUnit.getProblems().length);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement statement = (ReturnStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType());
- CharacterLiteral literal = (CharacterLiteral) expression;
- assertEquals("Wrong character", '\t', literal.charValue());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616
- */
- public void test0587() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " private char nextChar() {\n" +
- " return \'\\n\';\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals("Got problems", 0, compilationUnit.getProblems().length);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement statement = (ReturnStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType());
- CharacterLiteral literal = (CharacterLiteral) expression;
- assertEquals("Wrong character", '\n', literal.charValue());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616
- */
- public void test0588() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " private char nextChar() {\n" +
- " return \'\\f\';\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals("Got problems", 0, compilationUnit.getProblems().length);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement statement = (ReturnStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType());
- CharacterLiteral literal = (CharacterLiteral) expression;
- assertEquals("Wrong character", '\f', literal.charValue());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616
- */
- public void test0589() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " private char nextChar() {\n" +
- " return \'\\r\';\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals("Got problems", 0, compilationUnit.getProblems().length);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement statement = (ReturnStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType());
- CharacterLiteral literal = (CharacterLiteral) expression;
- assertEquals("Wrong character", '\r', literal.charValue());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616
- */
- public void test0590() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " private char nextChar() {\n" +
- " return \'\\\"\';\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals("Got problems", 0, compilationUnit.getProblems().length);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement statement = (ReturnStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType());
- CharacterLiteral literal = (CharacterLiteral) expression;
- assertEquals("Wrong character", '\"', literal.charValue());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616
- */
- public void test0591() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " private char nextChar() {\n" +
- " return \'\\'\';\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals("Got problems", 0, compilationUnit.getProblems().length);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement statement = (ReturnStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType());
- CharacterLiteral literal = (CharacterLiteral) expression;
- assertEquals("Wrong character", '\'', literal.charValue());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616
- */
- public void test0592() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " private char nextChar() {\n" +
- " return \'\\\\\';\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals("Got problems", 0, compilationUnit.getProblems().length);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement statement = (ReturnStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType());
- CharacterLiteral literal = (CharacterLiteral) expression;
- assertEquals("Wrong character", '\\', literal.charValue());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616
- */
- public void test0593() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " private char nextChar() {\n" +
- " return \'\\077\';\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals("Got problems", 0, compilationUnit.getProblems().length);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a return statement", ASTNode.RETURN_STATEMENT, node.getNodeType());
- ReturnStatement statement = (ReturnStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a character literal", ASTNode.CHARACTER_LITERAL, expression.getNodeType());
- CharacterLiteral literal = (CharacterLiteral) expression;
- assertEquals("Wrong character", '\077', literal.charValue());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82616
- */
- public void test0594() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " private char nextChar() {\n" +
- " return \'\\777\';\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals("Got problems", 1, compilationUnit.getProblems().length);
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertTrue("not malformed", isMalformed(methodDeclaration));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=82985
- */
- public void test0595() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0595", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(result);
- assertTrue("Not a compilation unit", result.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- assertProblemsSize(compilationUnit, 0);
- List imports = compilationUnit.imports();
- assertEquals("Wrong size", 1, imports.size());
- ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0);
- IBinding binding = importDeclaration.resolveBinding();
- assertNotNull("No binding", binding);
- assertEquals("Wrong type", IBinding.TYPE, binding.getKind());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=83098
- */
- public void test0596() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " void m(String[] args) {\n" +
- " for (int i= 0; i < args.length; i++) {\n" +
- " String string= args[i];\n" +
- " }\n" +
- " for (int i= 0; i < args.length; i++) {\n" +
- " String string= args[i];\n" +
- " }\n" +
- " }\n" +
- "}\n";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals("Got problems", 0, compilationUnit.getProblems().length);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not a for statement", ASTNode.FOR_STATEMENT, node.getNodeType());
- ForStatement forStatement = (ForStatement) node;
- Statement action = forStatement.getBody();
- assertEquals("Not a block", ASTNode.BLOCK, action.getNodeType());
- Block block = (Block) action;
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- Statement statement = (Statement) statements.get(0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement.getNodeType());
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
-
- node = getASTNode(compilationUnit, 0, 0, 1);
- assertEquals("Not a for statement", ASTNode.FOR_STATEMENT, node.getNodeType());
- forStatement = (ForStatement) node;
- action = forStatement.getBody();
- assertEquals("Not a block", ASTNode.BLOCK, action.getNodeType());
- block = (Block) action;
- statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- statement = (Statement) statements.get(0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement.getNodeType());
- variableDeclarationStatement = (VariableDeclarationStatement) statement;
- fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding2 = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding2);
-
- assertFalse("Bindings are equals", variableBinding.isEqualTo(variableBinding2));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=83210
- */
- public void test0597() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0597", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode node = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not an if statement", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Expression expression = ifStatement.getExpression();
- assertEquals("Not an instanceof expression", ASTNode.INSTANCEOF_EXPRESSION, expression.getNodeType());
- InstanceofExpression instanceofExpression = (InstanceofExpression) expression;
- Type type = instanceofExpression.getRightOperand();
- assertEquals("Not a simple type", ASTNode.SIMPLE_TYPE, type.getNodeType());
- SimpleType simpleType = (SimpleType) type;
- Name name = simpleType.getName();
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType());
- SimpleName simpleName = (SimpleName) name;
- ITypeBinding typeBinding = simpleName.resolveTypeBinding();
-
- List imports = compilationUnit.imports();
- assertEquals("Wrong size", 2, imports.size());
- ImportDeclaration importDeclaration = (ImportDeclaration) imports.get(0);
- name = importDeclaration.getName();
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, name.getNodeType());
- QualifiedName qualifiedName = (QualifiedName) name;
- simpleName = qualifiedName.getName();
- ITypeBinding typeBinding2 = simpleName.resolveTypeBinding();
-
- assertTrue("not identical", typeBinding == typeBinding2);
- assertTrue("not identical", typeBinding.isEqualTo(typeBinding2));
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=84778
- */
- public void test0598() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " int m(int i) {\n" +
- " return /*start*/1 + 2 + ++i/*end*/;\n" +
- " }\n" +
- "}\n";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, node.getNodeType());
- assertEquals("Wrong debug string", "1 + 2 + ++i", node.toString());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=86541
- */
- public void test0599() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0599", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode node = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- String expectedResult =
- "The hierarchy of the type X is inconsistent\n" +
- "The type test0599.Zork2 cannot be resolved. It is indirectly referenced from required .class files";
- assertProblemsSize(compilationUnit, 2, expectedResult);
- compilationUnit.accept(new ASTVisitor() {
- public void endVisit(FunctionDeclaration methodDeclaration) {
- Block body = methodDeclaration.getBody();
- assertNotNull("No body", body);
- assertTrue("No statements", body.statements().size() != 0);
- }
- });
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=87777
- */
- public void test0600() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0600", "Try.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode node = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement statement = (ExpressionStatement) node;
- Expression expression = statement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding = methodInvocation.resolveMethodBinding().getMethodDeclaration();
-
- sourceUnit = getCompilationUnit("Converter" , "src", "test0600", "C.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- node = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding().getMethodDeclaration();
-
- assertTrue("Not equals", methodBinding.isEqualTo(methodBinding2));
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=89014
- */
- public void test0601() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " Runnable one= new Runnable(){\n" +
- " public void run() {\n" +
- " }\n" +
- " };\n" +
- " Runnable two= new Runnable(){\n" +
- " public void run() {\n" +
- " }\n" +
- " };\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, expression.getNodeType());
- ClassInstanceCreation classInstanceCreation = (ClassInstanceCreation) expression;
- AnonymousClassDeclaration anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- assertNotNull("No anonymous", anonymousClassDeclaration);
- List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
-
- node = getASTNode(compilationUnit, 0, 1);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- fieldDeclaration = (FieldDeclaration) node;
- fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- expression = fragment.getInitializer();
- assertEquals("Not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, expression.getNodeType());
- classInstanceCreation = (ClassInstanceCreation) expression;
- anonymousClassDeclaration = classInstanceCreation.getAnonymousClassDeclaration();
- assertNotNull("No anonymous", anonymousClassDeclaration);
- bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 1, bodyDeclarations.size());
- bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType());
- methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding();
-
- assertFalse("Bindings are equals", methodBinding.isEqualTo(methodBinding2));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=70526
- */
- public void test0602() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0602", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode node = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- compilationUnit.accept(new ASTVisitor() {
- public boolean visit(StringLiteral stringLiteral) {
- assertTrue("Wrong start position", stringLiteral.getStartPosition() != 0);
- assertTrue("Wrong length", stringLiteral.getLength() != -1);
- return false;
- }
- });
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=91098
- */
- public void test0603() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0603", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode node = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- assertProblemsSize(compilationUnit, 0);
- compilationUnit.accept(new ASTVisitor() {
- public boolean visit(SimpleType type) {
- assertFalse("start cannot be -1", type.getStartPosition() == -1);
- assertFalse("length cannot be 0", type.getLength() == 0);
- return false;
- }
- public boolean visit(ArrayType type) {
- assertFalse("start cannot be -1", type.getStartPosition() == -1);
- assertFalse("length cannot be 0", type.getLength() == 0);
- return true;
- }
- });
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=91098
- */
- public void test0604() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0604", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode node = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- assertProblemsSize(compilationUnit, 0);
- compilationUnit.accept(new ASTVisitor() {
- public boolean visit(SimpleType type) {
- assertFalse("start cannot be -1", type.getStartPosition() == -1);
- assertFalse("length cannot be 0", type.getLength() == 0);
- return false;
- }
- public boolean visit(ArrayType type) {
- assertFalse("start cannot be -1", type.getStartPosition() == -1);
- assertFalse("length cannot be 0", type.getLength() == 0);
- return true;
- }
- });
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=92059
- * check resolvedType binding from variable ref (of array type)
- */
- public void test0605() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0605", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode node = runJLS3Conversion(sourceUnit, true, false);
- assertNotNull(node);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 1);
- assertEquals("Not a variable declaration", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement varDecl = (VariableDeclarationStatement) node;
- List fragments = varDecl.fragments();
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression.getNodeType());
- IBinding arraylength = ((QualifiedName)expression).resolveBinding();
- IJavaScriptElement element = arraylength.getJavaElement();
- assertNull("Shouldn't be binding for arraylength", element);
- Name name = ((QualifiedName) expression).getQualifier();
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType());
- ITypeBinding binding = name.resolveTypeBinding();
- assertNotNull("No binding", binding);
- assertTrue("No array", binding.isArray());
-
- node = getASTNode(compilationUnit, 0, 0, 4);
- assertEquals("Not a variable declaration", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- varDecl = (VariableDeclarationStatement) node;
- fragments = varDecl.fragments();
- fragment = (VariableDeclarationFragment) fragments.get(0);
- expression = fragment.getInitializer();
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression.getNodeType());
- name = ((QualifiedName) expression).getQualifier();
- assertEquals("Not a simple name", ASTNode.QUALIFIED_NAME, name.getNodeType());
- name = ((QualifiedName) name).getName();
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType());
- ITypeBinding binding2 = name.resolveTypeBinding();
- assertNotNull("No binding", binding2);
- assertTrue("No array", binding2.isArray());
-
- assertEquals("Not same binding", binding, binding2);
-
- node = getASTNode(compilationUnit, 0, 0, 2);
- assertEquals("Not a variable declaration", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- varDecl = (VariableDeclarationStatement) node;
- fragments = varDecl.fragments();
- fragment = (VariableDeclarationFragment) fragments.get(0);
- expression = fragment.getInitializer();
- assertEquals("Not a qualified name", ASTNode.FIELD_ACCESS, expression.getNodeType());
- expression = ((FieldAccess) expression).getExpression();
- assertEquals("Not a simple name", ASTNode.FIELD_ACCESS, expression.getNodeType());
- name = ((FieldAccess) expression).getName();
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, name.getNodeType());
- ITypeBinding binding3 = name.resolveTypeBinding();
- assertNotNull("No binding", binding3);
- assertTrue("No array", binding3.isArray());
-
- assertEquals("Not same binding", binding, binding3);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=89014
- */
- public void test0606() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " int i = 0;\n" +
- " i += 1;\n" +
- " String s = \"\";\n" +
- " s += \"hello world\";\n" +
- " System.out.println(i+s);\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertProblemsSize(compilationUnit, 0);
- node = getASTNode(compilationUnit, 0, 0, 1);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- Expression expression = ((ExpressionStatement) node).getExpression();
- assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType());
- Assignment assignment = (Assignment) expression;
- assertEquals("Wrong operator", Assignment.Operator.PLUS_ASSIGN, assignment.getOperator());
- ITypeBinding typeBinding = assignment.resolveTypeBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong type", "int", typeBinding.getQualifiedName());
-
- node = getASTNode(compilationUnit, 0, 0, 3);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- expression = ((ExpressionStatement) node).getExpression();
- assertEquals("Not an assignment", ASTNode.ASSIGNMENT, expression.getNodeType());
- assignment = (Assignment) expression;
- assertEquals("Wrong operator", Assignment.Operator.PLUS_ASSIGN, assignment.getOperator());
- typeBinding = assignment.resolveTypeBinding();
- assertNotNull("No binding", typeBinding);
- assertEquals("Wrong type", "java.lang.String", typeBinding.getQualifiedName());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=95262
- */
- public void test0607() throws JavaScriptModelException {
- final char[] source = "private static Category[] values = new Category[]{v1, v2, v3};".toCharArray();
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
- parser.setSource(source);
- ASTNode root = parser.createAST(null);
- assertNotNull("cannot be null", root);
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=96698
- */
- public void test0608() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " for (int /*start*/i = 0/*end*/; i < args.length; i++) {\n" +
- " System.out.println(args[i]);\n" +
- " }\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a variable declaration fragment", ASTNode.VARIABLE_DECLARATION_FRAGMENT, node.getNodeType());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) node;
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- IJavaScriptElement javaElement = variableBinding.getJavaElement();
- assertNotNull("No java element", javaElement);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=96698
- */
- public void test0609() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " int /*start*/i = 0/*end*/;\n" +
- " System.out.println(i);\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a variable declaration fragment", ASTNode.VARIABLE_DECLARATION_FRAGMENT, node.getNodeType());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) node;
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- IJavaScriptElement javaElement = variableBinding.getJavaElement();
- assertNotNull("No java element", javaElement);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=98088
- */
- public void test0610() throws JavaScriptModelException {
- final IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0610", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- final ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit unit = (JavaScriptUnit) result;
- assertProblemsSize(unit, 1, "The type Test is deprecated");
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=96698
- */
- public void test0611() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "abstract class SearchPattern {\n" +
- "}\n" +
- "class InternalSearchPattern extends SearchPattern {\n" +
- " boolean mustResolve;\n" +
- "}\n" +
- "public class X {\n" +
- " public static final int POSSIBLE_MATCH = 0;\n" +
- " public static final int ACCURATE_MATCH = 1;\n" +
- " \n" +
- " public void foo(SearchPattern pattern) {\n" +
- " int declarationLevel = ((InternalSearchPattern) pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH;\n" +
- " System.out.println(declarationLevel);\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 2, 2, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- checkSourceRange(expression, "((InternalSearchPattern) pattern).mustResolve ? POSSIBLE_MATCH : ACCURATE_MATCH", contents);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- public void test0612() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " void foo(boolean[]value) {\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration variableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(variableDeclaration, "boolean[]value", contents);
- Type type = variableDeclaration.getType();
- checkSourceRange(type, "boolean[]", contents);
- assertTrue("Not an array type", type.isArrayType());
- ArrayType arrayType = (ArrayType) type;
- Type componentType = arrayType.getComponentType();
- assertTrue("Not a primitive type", componentType.isPrimitiveType());
- PrimitiveType primitiveType = (PrimitiveType) componentType;
- assertEquals("Not boolean", PrimitiveType.BOOLEAN, primitiveType.getPrimitiveTypeCode());
- checkSourceRange(primitiveType, "boolean", contents);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- public void test0613() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " void foo(boolean b) {\n" +
- " Zork z = null;\n" +
- " if (b) {\n" +
- " System.out.println(z);\n" +
- " }\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 1, "Zork cannot be resolved to a type");
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding binding = fragment.resolveBinding();
- assertNull("Got a binding", binding);
-
- node = getASTNode(unit, 0, 0, 1);
- assertEquals("Not an if statement", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Statement statement2 = ifStatement.getThenStatement();
- assertEquals("Not a block", ASTNode.BLOCK, statement2.getNodeType());
- Block block = (Block) statement2;
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
-
- Statement statement3 = (Statement) statements.get(0);
- assertEquals("Not a expression statement", ASTNode.EXPRESSION_STATEMENT, statement3.getNodeType());
- ExpressionStatement expressionStatement = (ExpressionStatement) statement3;
- Expression expression = expressionStatement.getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation methodInvocation = (FunctionInvocation) expression;
- List arguments = methodInvocation.arguments();
- assertEquals("Wrong size", 1, arguments.size());
- Expression expression2 = (Expression) arguments.get(0);
- ITypeBinding typeBinding = expression2.resolveTypeBinding();
- assertNull("Got a binding", typeBinding);
- assertEquals("Not a simple name", ASTNode.SIMPLE_NAME, expression2.getNodeType());
- SimpleName simpleName = (SimpleName) expression2;
- IBinding binding2 = simpleName.resolveBinding();
- assertNull("Got a binding", binding2);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- // https://bugs.eclipse.org/bugs/show_bug.cgi?id=105192
- public void test0614() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "class T { void m() { for (i=0, j=0; i<10; i++, j++) ; }}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", false/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- final String expectedOutput = "class T {\n" +
- " void m(){\n" +
- " for (i=0, j=0; i < 10; i++, j++) ;\n" +
- " }\n" +
- "}\n";
- assertEquals("Wrong output", Util.convertToIndependantLineDelimiter(expectedOutput), Util.convertToIndependantLineDelimiter(node.toString()));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=100041
- */
- public void test0615() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "class X {\n" +
- " static Object object;\n" +
- " static void foo() {\n" +
- " /**\n" +
- " * javadoc comment.\n" +
- " */\n" +
- " if (object instanceof String) {\n" +
- " final String clr = null;\n" +
- " }\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 1, 0);
- assertNotNull("No node", node);
- assertEquals("Not an if statement", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- String expectedSource = "if (object instanceof String) {\n" +
- " final String clr = null;\n" +
- " }";
- checkSourceRange(ifStatement, expectedSource, contents);
- Statement statement = ifStatement.getThenStatement();
- assertNotNull("No then statement", statement);
- assertEquals("not a block", ASTNode.BLOCK, statement.getNodeType());
- Block block = (Block) statement;
- expectedSource = "{\n" +
- " final String clr = null;\n" +
- " }";
- checkSourceRange(block, expectedSource, contents);
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- Statement statement2 = (Statement) statements.get(0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement2.getNodeType());
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement2;
- checkSourceRange(variableDeclarationStatement, "final String clr = null;", contents);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=109333
- */
- public void test0616() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "class X {\n" +
- " boolean val = true && false && true && false && true;\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertEquals("Not a field declaration ", ASTNode.FIELD_DECLARATION, node.getNodeType());
- final FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- final List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- final Expression initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, initializer.getNodeType());
- InfixExpression infixExpression = (InfixExpression) initializer;
- final List extendedOperands = infixExpression.extendedOperands();
- assertEquals("Wrong size", 3, extendedOperands.size());
- assertEquals("Wrong operator", InfixExpression.Operator.CONDITIONAL_AND, infixExpression.getOperator());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=109333
- */
- public void test0617() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "class X {\n" +
- " boolean val = true || false || true || false || true;\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertEquals("Not a field declaration ", ASTNode.FIELD_DECLARATION, node.getNodeType());
- final FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- final List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- final Expression initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, initializer.getNodeType());
- InfixExpression infixExpression = (InfixExpression) initializer;
- final List extendedOperands = infixExpression.extendedOperands();
- assertEquals("Wrong size", 3, extendedOperands.size());
- assertEquals("Wrong operator", InfixExpression.Operator.CONDITIONAL_OR, infixExpression.getOperator());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=109535
- */
- public void test0618() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " String f = \"\" + \"\" - 1;\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", false/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertEquals("Not a field declaration ", ASTNode.FIELD_DECLARATION, node.getNodeType());
- final FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- final List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- final Expression initializer = fragment.getInitializer();
- assertNotNull("No initializer", initializer);
- assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, initializer.getNodeType());
- InfixExpression infixExpression = (InfixExpression) initializer;
- List extendedOperands = infixExpression.extendedOperands();
- assertEquals("Wrong size", 0, extendedOperands.size());
- assertEquals("Wrong operator", InfixExpression.Operator.MINUS, infixExpression.getOperator());
- Expression leftOperand = infixExpression.getLeftOperand();
- assertEquals("Not an infix expression", ASTNode.INFIX_EXPRESSION, leftOperand.getNodeType());
- InfixExpression infixExpression2 = (InfixExpression) leftOperand;
- extendedOperands = infixExpression.extendedOperands();
- assertEquals("Wrong size", 0, extendedOperands.size());
- assertEquals("Wrong operator", InfixExpression.Operator.PLUS, infixExpression2.getOperator());
- assertEquals("Not a string literal", ASTNode.STRING_LITERAL, infixExpression2.getLeftOperand().getNodeType());
- assertEquals("Not a string literal", ASTNode.STRING_LITERAL, infixExpression2.getRightOperand().getNodeType());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=109646
- */
- public void test0619() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter", "src", "test0619", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, false);
- final JavaScriptUnit unit = (JavaScriptUnit) result;
- assertProblemsSize(unit, 0);
- ASTNode node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- ASTNode statement = node;
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind(ASTParser.K_STATEMENTS);
- parser.setSource(source);
- parser.setSourceRange(statement.getStartPosition(), statement.getLength());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result2 = parser.createAST(null);
- assertNotNull("No node", result2);
- assertTrue("not a block", result2.getNodeType() == ASTNode.BLOCK);
- Block block = (Block) result2;
- List statements = block.statements();
- assertEquals("wrong size", 1, statements.size());
- Statement statement2 = (Statement) statements.get(0);
- assertEquals("Statement is not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement2.getNodeType());
- VariableDeclarationStatement declarationStatement = (VariableDeclarationStatement) statement2;
- assertEquals("Wrong number of fragments", 4, declarationStatement.fragments().size());
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=109940
- */
- public void test0620() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println((int) \'\\0\');\n" +
- " System.out.println((int) \'\\1\');\n" +
- " System.out.println((int) \'\\2\');\n" +
- " System.out.println((int) \'\\3\');\n" +
- " System.out.println((int) \'\\4\');\n" +
- " System.out.println((int) \'\\5\');\n" +
- " System.out.println((int) \'\\6\');\n" +
- " System.out.println((int) \'\\7\');\n" +
- " System.out.println((int) \'\\077\');\n" +
- " System.out.println((int) \'\\55\');\n" +
- " System.out.println((int) \'\\77\');\n" +
- " System.out.println((int) \'\\377\');\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", false/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- unit.accept(new ASTVisitor() {
- public boolean visit(CharacterLiteral characterLiteral) {
- try {
- final String escapedValue = characterLiteral.getEscapedValue();
- final char charValue = characterLiteral.charValue();
- if (escapedValue.equals("\'\\0\'")) {
- assertEquals("Wrong value", 0, charValue);
- } else if (escapedValue.equals("\'\\1\'")) {
- assertEquals("Wrong value", 1, charValue);
- } else if (escapedValue.equals("\'\\2\'")) {
- assertEquals("Wrong value", 2, charValue);
- } else if (escapedValue.equals("\'\\3\'")) {
- assertEquals("Wrong value", 3, charValue);
- } else if (escapedValue.equals("\'\\4\'")) {
- assertEquals("Wrong value", 4, charValue);
- } else if (escapedValue.equals("\'\\5\'")) {
- assertEquals("Wrong value", 5, charValue);
- } else if (escapedValue.equals("\'\\6\'")) {
- assertEquals("Wrong value", 6, charValue);
- } else if (escapedValue.equals("\'\\7\'")) {
- assertEquals("Wrong value", 7, charValue);
- } else if (escapedValue.equals("\'\\077\'")) {
- assertEquals("Wrong value", 63, charValue);
- } else if (escapedValue.equals("\'\\55\'")) {
- assertEquals("Wrong value", 45, charValue);
- } else if (escapedValue.equals("\'\\77\'")) {
- assertEquals("Wrong value", 63, charValue);
- } else if (escapedValue.equals("\'\\377\'")) {
- assertEquals("Wrong value", 255, charValue);
- } else {
- assertTrue("Should not get there", false);
- }
- } catch(IllegalArgumentException e) {
- assertTrue("Should not happen", false);
- }
- return false;
- }
- });
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=109963
- */
- public void test0621() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public void foo(int y) {\n" +
- " switch (y) {\n" +
- " case 1:\n" +
- " int i,j;\n" +
- " }\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", false/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0, 0);
- assertNotNull("No node", node);
- assertEquals("Not a switch statement", ASTNode.SWITCH_STATEMENT, node.getNodeType());
- SwitchStatement switchStatement = (SwitchStatement) node;
- List statements = switchStatement.statements();
- assertEquals("Wrong size", 2, statements.size());
- Statement statement = (Statement) statements.get(1);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement.getNodeType());
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement;
- assertEquals("Wrong size", 2, variableDeclarationStatement.fragments().size());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=92866
- */
- public void test0622() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " System.out.println((int) \'\\0\');\n" +
- " System.out.println((int) \'\\00\');\n" +
- " System.out.println((int) \'\\000\');\n" +
- " System.out.println((int) \'\\40\');\n" +
- " System.out.println((int) \'\\040\');\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", false/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- unit.accept(new ASTVisitor() {
- public boolean visit(CharacterLiteral characterLiteral) {
- try {
- characterLiteral.charValue();
- } catch(IllegalArgumentException e) {
- assertTrue("Should not happen", false);
- }
- return false;
- }
- });
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=116573
- */
- public void test0623() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "class X {\n" +
- " X(boolean x, String y, String z) {}\n" +
- " X(int x, String y) {}\n" +
- " X(String x) {\n" +
- " this(first, second);\n" +
- " }\n" +
- " void test() {\n" +
- " new X(first, second);\n" +
- " }\n" +
- " class Z extends X {\n" +
- " public Z() {\n" +
- " super(first, second);\n" +
- " }\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- String expectedOutput =
- "first cannot be resolved\n" +
- "second cannot be resolved\n" +
- "first cannot be resolved\n" +
- "second cannot be resolved\n" +
- "first cannot be resolved\n" +
- "second cannot be resolved";
- assertProblemsSize(unit, 6, expectedOutput);
- unit.accept(new ASTVisitor() {
- public boolean visit(ConstructorInvocation constructorInvocation) {
- assertNotNull("No binding", constructorInvocation.resolveConstructorBinding());
- return false;
- }
- public boolean visit(ClassInstanceCreation classInstanceCreation) {
- assertNotNull("No binding", classInstanceCreation.resolveConstructorBinding());
- return false;
- }
- });
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=118876
- */
- public void test0624() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X extend {}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- String expectedOutput =
- "Syntax error on token \"extend\", delete this token";
- assertProblemsSize(unit, 1, expectedOutput);
- unit.accept(new ASTVisitor() {
- public boolean visit(TypeDeclaration typeDeclaration) {
- assertTrue("Should be malformed", isMalformed(typeDeclaration));
- return false;
- }
- public boolean visit(JavaScriptUnit compilationUnit) {
- assertFalse("Should not be malformed", isMalformed(compilationUnit));
- return true;
- }
- });
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=118897
- */
- public void test0625() {
- char[] source =
- ("package test0305;\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- "class Test {\n" + //$NON-NLS-1$
- " public void foo(int arg) {}\n" + //$NON-NLS-1$
- "}").toCharArray(); //$NON-NLS-1$
- IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$
- ASTNode result = runConversion(AST.JLS3, source, "Test.js", project); //$NON-NLS-1$
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0);
- assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNull("Got a type binding", typeBinding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=118897
- */
- public void test0626() {
- char[] source =
- ("package java.lang;\n" + //$NON-NLS-1$
- "\n" + //$NON-NLS-1$
- "class Object {\n" + //$NON-NLS-1$
- " public void foo(int arg) {}\n" + //$NON-NLS-1$
- "}").toCharArray(); //$NON-NLS-1$
- IJavaScriptProject project = getJavaProject("Converter"); //$NON-NLS-1$
- ASTNode result = runConversion(AST.JLS3, source, "Object.js", project); //$NON-NLS-1$
- assertNotNull("No compilation unit", result); //$NON-NLS-1$
- assertTrue("result is not a compilation unit", result instanceof JavaScriptUnit); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(compilationUnit, 0);
- assertTrue("not a TypeDeclaration", node instanceof TypeDeclaration); //$NON-NLS-1$
- TypeDeclaration typeDeclaration = (TypeDeclaration) node;
- ITypeBinding typeBinding = typeDeclaration.resolveBinding();
- assertNull("Got a type binding", typeBinding); //$NON-NLS-1$
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=116833
- */
- public void test0627() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " void m() {\n" +
- " error();\n" +
- " new Cloneable() {\n" +
- " void xx() {}\n" +
- " };\n" +
- " new Cloneable() {\n" +
- " void xx() {}\n" +
- " };\n" + " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- String expectedOutput =
- "The method error() is undefined for the type X";
- assertProblemsSize(unit, 1, expectedOutput);
- node = getASTNode(unit, 0, 0, 1);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- Expression expression = ((ExpressionStatement) node).getExpression();
- assertEquals("Not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, expression.getNodeType());
- AnonymousClassDeclaration anonymousClassDeclaration = ((ClassInstanceCreation) expression).getAnonymousClassDeclaration();
- assertNotNull("No anonymous class declaration", anonymousClassDeclaration);
- List bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 1, bodyDeclarations.size());
- BodyDeclaration bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- IFunctionBinding methodBinding = methodDeclaration.resolveBinding();
-
- node = getASTNode(unit, 0, 0, 2);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- expression = ((ExpressionStatement) node).getExpression();
- assertEquals("Not a class instance creation", ASTNode.CLASS_INSTANCE_CREATION, expression.getNodeType());
- anonymousClassDeclaration = ((ClassInstanceCreation) expression).getAnonymousClassDeclaration();
- assertNotNull("No anonymous class declaration", anonymousClassDeclaration);
- bodyDeclarations = anonymousClassDeclaration.bodyDeclarations();
- assertEquals("Wrong size", 1, bodyDeclarations.size());
- bodyDeclaration = (BodyDeclaration) bodyDeclarations.get(0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, bodyDeclaration.getNodeType());
- methodDeclaration = (FunctionDeclaration) bodyDeclaration;
- IFunctionBinding methodBinding2 = methodDeclaration.resolveBinding();
-
- assertFalse("Should not be equal", methodBinding.isEqualTo(methodBinding2));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=125270
- */
- public void test0628() throws JavaScriptModelException {
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind(ASTParser.K_EXPRESSION);
- String source = "{\"red\", \"yellow\"}";
- parser.setSource(source.toCharArray());
- parser.setSourceRange(0, source.length());
- parser.setCompilerOptions(JavaScriptCore.getOptions());
- ASTNode result = parser.createAST(null);
- assertNotNull("No node", result);
- assertEquals("not an array initializer", ASTNode.ARRAY_INITIALIZER, result.getNodeType());
- ArrayInitializer arrayInitializer = (ArrayInitializer) result;
- List expressions = arrayInitializer.expressions();
- assertEquals("Wrong size", 2, expressions.size());
- assertEquals("Wrong type", ASTNode.STRING_LITERAL, ((Expression) expressions.get(0)).getNodeType());
- assertEquals("Wrong type", ASTNode.STRING_LITERAL, ((Expression) expressions.get(1)).getNodeType());
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=126598
- */
- public void test0629() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0629", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true, true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- String expectedOutput =
- "Syntax error on token \",\", invalid VariableInitializer";
- assertProblemsSize(compilationUnit, 1, expectedOutput);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a compilation unit", ASTNode.FIELD_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- checkSourceRange(fragment, "s = {\"\",,,}", source);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=126598
- */
- public void test0630() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0630", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true, true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- String expectedOutput =
- "Syntax error on token \",\", invalid VariableInitializer";
- assertProblemsSize(compilationUnit, 1, expectedOutput);
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=126598
- */
- public void test0631() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0631", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- char[] source = sourceUnit.getSource().toCharArray();
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true, true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType()); //$NON-NLS-1$
- JavaScriptUnit compilationUnit = (JavaScriptUnit) result;
- String expectedOutput =
- "Syntax error, insert \"}\" to complete ArrayInitializer\n" +
- "Syntax error, insert \";\" to complete FieldDeclaration\n" +
- "Syntax error, insert \"}\" to complete ClassBody";
- assertProblemsSize(compilationUnit, 3, expectedOutput);
- ASTNode node = getASTNode(compilationUnit, 0, 0);
- assertEquals("Not a compilation unit", ASTNode.FIELD_DECLARATION, node.getNodeType()); //$NON-NLS-1$
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- checkSourceRange(fragment, "s = {\"\",,,", source);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=128539
- */
- public void test0632() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " void m(int state) {\n" +
- " switch (state) {\n" +
- " case 4:\n" +
- " double M0,M1;\n" +
- " }\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a switch statement", ASTNode.SWITCH_STATEMENT, node.getNodeType());
- SwitchStatement statement = (SwitchStatement) node;
- List statements = statement.statements();
- assertEquals("wrong size", 2, statements.size());
- assertEquals("Not a switch case", ASTNode.SWITCH_CASE, ((ASTNode) statements.get(0)).getNodeType());
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, ((ASTNode) statements.get(1)).getNodeType());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=128539
- */
- public void test0633() {
- String src = "switch (state) {case 4:double M0,M1;}";
- char[] source = src.toCharArray();
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind (ASTParser.K_STATEMENTS);
- parser.setSource (source);
- ASTNode result = parser.createAST (null);
- assertNotNull("no result", result);
- assertEquals("Wrong type", ASTNode.BLOCK, result.getNodeType());
- Block block = (Block) result;
- List statements = block.statements();
- assertNotNull("No statements", statements);
- assertEquals("Wrong size", 1, statements.size());
- final ASTNode node = (ASTNode) statements.get(0);
- assertEquals("Not a switch statement", ASTNode.SWITCH_STATEMENT, node.getNodeType());
- SwitchStatement statement = (SwitchStatement) node;
- statements = statement.statements();
- assertEquals("wrong size", 2, statements.size());
- assertEquals("Not a switch case", ASTNode.SWITCH_CASE, ((ASTNode) statements.get(0)).getNodeType());
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, ((ASTNode) statements.get(1)).getNodeType());
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=128823
- */
- public void test0634() throws JavaScriptModelException {
- try {
- String src =
- "public class X {\n" +
- " void foo() {\n" +
- " int i1 i1;\n" +
- " int i2 i2;\n" +
- " int i3 i3;\n" +
- " int i4 i4;\n" +
- " int i5 i5;\n" +
- " int i6 i6;\n" +
- " int i7 i7;\n" +
- " int i8 i8;\n" +
- " int i9 i9;\n" +
- " int i10 i10;\n" +
- " int i11 i11;\n" +
- " \n" +
- " for for ;;){}\n" +
- " }\n" +
- "}";
-
- char[] source = src.toCharArray();
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind (ASTParser.K_COMPILATION_UNIT);
- parser.setSource (source);
- parser.setStatementsRecovery(true);
- ASTNode result = parser.createAST (null);
- assertNotNull("no result", result);
- } catch (ArrayIndexOutOfBoundsException e) {
- assertTrue("ArrayIndexOutOfBoundsException", false);
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=128960
- */
- public void test0635() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " void foo(Object tab[]) {\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- List parameters = declaration.parameters();
- assertEquals("wrong number", 1, parameters.size());
- SingleVariableDeclaration variableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(variableDeclaration, "Object tab[]", contents);
- checkSourceRange(variableDeclaration.getType(), "Object", contents);
- checkSourceRange(variableDeclaration.getName(), "tab", contents);
- assertEquals("wrong number of extra dimensions", 1, variableDeclaration.getExtraDimensions());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=128960
- */
- public void test0636() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " void foo(java.lang.Object tab[]) {\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- List parameters = declaration.parameters();
- assertEquals("wrong number", 1, parameters.size());
- SingleVariableDeclaration variableDeclaration = (SingleVariableDeclaration) parameters.get(0);
- checkSourceRange(variableDeclaration, "java.lang.Object tab[]", contents);
- checkSourceRange(variableDeclaration.getType(), "java.lang.Object", contents);
- checkSourceRange(variableDeclaration.getName(), "tab", contents);
- assertEquals("wrong number of extra dimensions", 1, variableDeclaration.getExtraDimensions());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=128961
- */
- public void test0637() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " void foo() {\n" +
- " for( int i = (1); ; ) {\n" +
- " }\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a for statement", ASTNode.FOR_STATEMENT, node.getNodeType());
- ForStatement forStatement = (ForStatement) node;
- List inits = forStatement.initializers();
- assertEquals("Wrong size", 1, inits.size());
- Expression expression = (Expression) inits.get(0);
- assertEquals("Not a variable declaration expression", ASTNode.VARIABLE_DECLARATION_EXPRESSION, expression.getNodeType());
- VariableDeclarationExpression declarationExpression = (VariableDeclarationExpression) expression;
- List fragments = declarationExpression.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initializer = fragment.getInitializer();
- checkSourceRange(initializer, "(1)", contents);
- checkSourceRange(fragment, "i = (1)", contents);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=128961
- */
- public void test0638() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " int i = (1);\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration fieldDeclaration = (FieldDeclaration) node;
- List fragments = fieldDeclaration.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initializer = fragment.getInitializer();
- checkSourceRange(initializer, "(1)", contents);
- checkSourceRange(fragment, "i = (1)", contents);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=128961
- */
- public void test0639() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " void foo() {\n" +
- " for( int i = (1), j = 0; ; ) {\n" +
- " }\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a for statement", ASTNode.FOR_STATEMENT, node.getNodeType());
- ForStatement forStatement = (ForStatement) node;
- List inits = forStatement.initializers();
- assertEquals("Wrong size", 1, inits.size());
- Expression expression = (Expression) inits.get(0);
- assertEquals("Not a variable declaration expression", ASTNode.VARIABLE_DECLARATION_EXPRESSION, expression.getNodeType());
- VariableDeclarationExpression declarationExpression = (VariableDeclarationExpression) expression;
- List fragments = declarationExpression.fragments();
- assertEquals("Wrong size", 2, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression initializer = fragment.getInitializer();
- checkSourceRange(initializer, "(1)", contents);
- checkSourceRange(fragment, "i = (1)", contents);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=129589
- * TODO (david) enable once fixed
- */
- public void _test0640() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " protected void primExecute() {\n" +
- " String temp= this.toString();\n" +
- " }\n" +
- " if (image != null) {\n" +
- " Object loc = null;\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 2, "Syntax error on token \"}\", { expected after this token\n" +
- "Syntax error, insert \"}\" to complete ClassBody");
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- assertFalse("A recovered node", isRecovered(methodDeclaration));
- assertFalse("A malformed node", isMalformed(methodDeclaration));
- assertFalse("A recovered node", isRecovered(methodDeclaration.getBody()));
- assertFalse("A malformed node", isMalformed(methodDeclaration.getBody()));
- node = getASTNode(unit, 0, 1);
- assertEquals("Not an initializer", ASTNode.INITIALIZER, node.getNodeType());
- Initializer initializer = (Initializer) node;
- assertTrue("Not a recovered node", isRecovered(initializer));
- assertTrue("Not a malformed node", isMalformed(initializer));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * Ensures that 2 type bindings (one from .class file, the other from attache source) are "isEqualTo(...)".
- * (regression test for bug 130317 ASTParser with IClassFile as source creates type bindings that are not isEqualTo(..) binary bindings)
- */
- public void test0641() throws JavaScriptModelException {
- // Integer from attached source
- IClassFile classFile = getClassFile("Converter", getConverterJCLPath().toOSString(), "java.lang", "Integer.class");
- String source = classFile.getSource();
- MarkerInfo markerInfo = new MarkerInfo(source);
- markerInfo.astStarts = new int[] {source.indexOf("public")};
- markerInfo.astEnds = new int[] {source.lastIndexOf('}') + 1};
- ASTNode node = buildAST(markerInfo, classFile);
- IBinding bindingFromAttachedSource = ((TypeDeclaration) node).resolveBinding();
-
- IJavaScriptUnit workingCopy = null;
- try {
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- String contents =
- "public class X {\n" +
- " /*start*/Integer/*end*/ field;\n" +
- "}";
- IBinding[] bindings = resolveBindings(contents, workingCopy);
- assertTrue("2 type bindings should be equals", bindingFromAttachedSource.isEqualTo(bindings[0]));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=129330
- */
- public void test0642() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "import java.awt.Point;\n" +
- "public class X {\n" +
- " public void foo(Point p, int[] a) {\n" +
- " p.x;\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 1, "Syntax error, insert \"AssignmentOperator Expression\" to complete Expression");
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- assertTrue("Not recovered", isRecovered(node));
- final Expression expression = ((ExpressionStatement) node).getExpression();
- assertEquals("Not a qualified name", ASTNode.QUALIFIED_NAME, expression.getNodeType());
- assertTrue("Not recovered", isRecovered(expression));
- checkSourceRange(expression, "p.x", contents);
- checkSourceRange(node, "p.x;", contents);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=129330
- */
- public void test0643() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "import java.awt.Point;\n" +
- "public class X {\n" +
- " public void foo(Point p, int[] a) {\n" +
- " a[0];\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 1, "Syntax error, insert \"AssignmentOperator Expression\" to complete Expression");
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- assertTrue("Not recovered", isRecovered(node));
- final Expression expression = ((ExpressionStatement) node).getExpression();
- assertEquals("Not an array access", ASTNode.ARRAY_ACCESS, expression.getNodeType());
- assertTrue("Not recovered", isRecovered(expression));
- checkSourceRange(expression, "a[0]", contents);
- checkSourceRange(node, "a[0];", contents);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=129330
- */
- public void test0644() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public void foo() {\n" +
- " int x =;\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 1, "Syntax error on token \"=\", VariableInitializer expected after this token");
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a vaviable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertNull("No initializer", expression);
- assertTrue("Not recovered", isRecovered(fragment));
- checkSourceRange(fragment, "x =", contents);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=135997
- */
- public void test0645() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " {\n" +
- " new Object();\n" +
- " Object.equ;\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(
- unit,
- 2,
- "Object.equ cannot be resolved\n" +
- "Syntax error, insert \"AssignmentOperator Expression\" to complete Expression");
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a field declaration statement", ASTNode.INITIALIZER, node.getNodeType());
- Initializer initializer = (Initializer) node;
- checkSourceRange(
- initializer,
- "{\n" +
- " new Object();\n" +
- " Object.equ;\n" +
- " }",
- contents);
- Block block = initializer.getBody();
- checkSourceRange(
- block,
- "{\n" +
- " new Object();\n" +
- " Object.equ;\n" +
- " }",
- contents);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=136972
- */
- public void test0646() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " static {\n" +
- " class A\n" +
- " Object o = new Object(){\n" +
- " void test(){\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=141043
- */
- public void test0647() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public void run(int i) {\n" +
- " }\n" +
- " public void foo() {\n" +
- " new Runnable() {\n" +
- " public void run() {\n" +
- " run(1); \n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 1, "The method run() in the type new Runnable(){} is not applicable for the arguments (int)");
- node = getASTNode(unit, 0, 1, 0);
- assertEquals("Not an expression statement", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- Expression expression = ((ExpressionStatement) node).getExpression();
- ITypeBinding typeBinding = expression.resolveTypeBinding();
- IFunctionBinding[] methodBindings = typeBinding.getDeclaredMethods();
- assertEquals("Wrong size", 2, methodBindings.length);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=147877
- */
- public void test0648() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public void foo(int[] a) {\n" +
- " int i = a[0];\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a vaviable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertNotNull("No initializer", expression);
- checkSourceRange(expression, "a[0]", contents);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=147877
- */
- public void test0649() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public void foo(int[] a) {\n" +
- " int i = a[0\\u005D;\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a vaviable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertNotNull("No initializer", expression);
- checkSourceRange(expression, "a[0\\u005D", contents);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=147877
- */
- public void test0650() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public void foo(int[] a) {\n" +
- " int[] i = new int[0];\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a vaviable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertNotNull("No initializer", expression);
- checkSourceRange(expression, "new int[0]", contents);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=147877
- */
- public void test0651() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public void foo(int[] a) {\n" +
- " int[] i = new int[0\\u005D;\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a vaviable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- Expression expression = fragment.getInitializer();
- assertNotNull("No initializer", expression);
- checkSourceRange(expression, "new int[0\\u005D", contents);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=149126
- */
- public void _test0652() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "import java.nio.ByteBuffer;\n" +
- "import java.nio.CharBuffer;\n" +
- "import java.nio.charset.Charset;\n" +
- "import java.nio.charset.CharsetDecoder;\n" +
- "import java.nio.charset.CharsetEncoder;\n" +
- "import java.nio.charset.CoderResult;\n" +
- "public class TestCharset extends Charset {\n" +
- " public CharsetDecoder newDecoder() {\n" +
- " return new CharsetDecoder(this, 2.0, 2.0) {\n" +
- " CharsetDecoder(CharSet\n" +
- " protected CoderResult decodeLoop(ByteBuffer in,\n" +
- "CharBuffer out) {\n" +
- " return null;\n" +
- " }\n" +
- " };;\n" +
- " }\n" +
- " public CharsetEncoder newEncoder() {\n" +
- " return null;\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 1);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=150409
- * TODO (olivier) renable if the bindings are available
- */
- public void _test0653() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0653", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- ASTNode result = runConversion(AST.JLS3, sourceUnit, true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) result;
-
- ASTNode node = getASTNode(unit, 0, 2, 0);
- assertEquals("Not a method invocation", ASTNode.EXPRESSION_STATEMENT, node.getNodeType());
- ExpressionStatement statement = (ExpressionStatement) node;
- FunctionInvocation invocation = (FunctionInvocation) statement.getExpression();
- List arguments = invocation.arguments();
- assertEquals("Wrong size", 1, arguments.size());
- Expression argument = (Expression) arguments.get(0);
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, argument.getNodeType());
- invocation = (FunctionInvocation) argument;
- Expression expression = invocation.getExpression();
- assertEquals("Not a method invocation", ASTNode.FIELD_ACCESS, expression.getNodeType());
- FieldAccess fieldAccess = (FieldAccess) expression;
- IVariableBinding variableBinding = fieldAccess.resolveFieldBinding();
- assertNotNull("No variable binding", variableBinding);
- }
-
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=148224
- */
- public void test0654() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " int i;\n" +
- " public void foo(int[] a) {\n" +
- " }\n" +
- " String s;\n" +
- " public String[][] bar() {\n" +
- " return null;\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false,
- true);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 0);
- node = getASTNode(unit, 0, 0);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- FieldDeclaration declaration = (FieldDeclaration) node;
- Type type = declaration.getType();
- ITypeBinding typeBinding = type.resolveBinding();
- assertTrue("Not a primitive type", typeBinding.isPrimitive());
- assertEquals("Not int", "int", typeBinding.getName());
- try {
- typeBinding.createArrayType(-1);
- assertTrue("Should throw an exception", false);
- } catch(IllegalArgumentException exception) {
- // ignore
- }
- try {
- typeBinding.createArrayType(0);
- assertTrue("Should throw an exception", false);
- } catch(IllegalArgumentException exception) {
- // ignore
- }
- try {
- typeBinding.createArrayType(256);
- assertTrue("Should throw an exception", false);
- } catch(IllegalArgumentException exception) {
- // ignore
- }
- ITypeBinding binding = typeBinding.createArrayType(2);
- assertEquals("Wrong dimensions", 2, binding.getDimensions());
- assertTrue("Not an array type binding", binding.isArray());
- ITypeBinding componentType = binding.getComponentType();
- assertTrue("Not an array type binding", componentType.isArray());
- assertEquals("Wrong dimensions", 1, componentType.getDimensions());
- componentType = componentType.getComponentType();
- assertFalse("An array type binding", componentType.isArray());
- assertEquals("Wrong dimensions", 0, componentType.getDimensions());
-
- binding = typeBinding.createArrayType(1);
- node = getASTNode(unit, 0, 1);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) node;
- List parameters = methodDeclaration.parameters();
- assertEquals("Wrong size", 1, parameters.size());
- SingleVariableDeclaration parameter = (SingleVariableDeclaration) parameters.get(0);
- Type type2 = parameter.getType();
- ITypeBinding typeBinding2 = type2.resolveBinding();
- assertNotNull("No binding", typeBinding2);
- assertTrue("Not an array binding", typeBinding2.isArray());
- assertEquals("Wrong dimension", 1, typeBinding2.getDimensions());
- assertEquals("Wrong type", "int", typeBinding2.getElementType().getName());
- assertTrue("Should be equals", binding == typeBinding2);
-
- binding = typeBinding2.createArrayType(3);
- assertTrue("Not an array binding", binding.isArray());
- assertEquals("Wrong dimension", 4, binding.getDimensions());
-
- node = getASTNode(unit, 0, 2);
- assertEquals("Not a field declaration", ASTNode.FIELD_DECLARATION, node.getNodeType());
- declaration = (FieldDeclaration) node;
- type = declaration.getType();
- typeBinding = type.resolveBinding();
- assertTrue("A primitive type", !typeBinding.isPrimitive());
- assertEquals("Not String", "String", typeBinding.getName());
-
- binding = typeBinding.createArrayType(1);
- node = getASTNode(unit, 0, 3);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- methodDeclaration = (FunctionDeclaration) node;
- type = methodDeclaration.getReturnType2();
- assertNotNull("No return type", type);
- typeBinding2 = type.resolveBinding();
- assertNotNull("No binding", typeBinding2);
- assertTrue("Not an array binding", typeBinding2.isArray());
- assertEquals("Wrong dimension", 2, typeBinding2.getDimensions());
- assertEquals("Wrong type", "String", typeBinding2.getElementType().getName());
- typeBinding2 = typeBinding2.getComponentType();
- assertTrue("Not an array binding", typeBinding2.isArray());
- assertEquals("Wrong dimension", 1, typeBinding2.getDimensions());
- assertTrue("Should be equals", binding == typeBinding2);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=157570
- */
- public void _test0655() {
- String src = "public static void m1()\n" +
- " {\n" +
- " int a;\n" +
- " int b;\n" +
- " }\n" +
- "\n" +
- " public static void m2()\n" +
- " {\n" +
- " int c;\n" +
- " int d;\n" +
- " }";
- char[] source = src.toCharArray();
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind (ASTParser.K_STATEMENTS);
- parser.setStatementsRecovery(true);
- parser.setSource (source);
- ASTNode result = parser.createAST (null);
- assertNotNull("no result", result);
- assertEquals("Not a block", ASTNode.BLOCK, result.getNodeType());
- Block block = (Block) result;
- List statements = block.statements();
- for (Iterator iterator = statements.iterator(); iterator.hasNext(); ) {
- Statement statement = (Statement) iterator.next();
- assertTrue(isMalformed(statement));
- }
- }
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=157570
- */
- public void test0656() {
- String src = "public static void m1()\n" +
- " {\n" +
- " int a;\n" +
- " int b;\n" +
- " }\n" +
- "\n" +
- " public static void m2()\n" +
- " {\n" +
- " int c;\n" +
- " int d;\n" +
- " }";
- char[] source = src.toCharArray();
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind (ASTParser.K_STATEMENTS);
- parser.setStatementsRecovery(false);
- parser.setSource (source);
- ASTNode result = parser.createAST (null);
- assertNotNull("no result", result);
- assertEquals("Not a block", ASTNode.BLOCK, result.getNodeType());
- Block block = (Block) result;
- List statements = block.statements();
- assertEquals("Should be empty", 0, statements.size());
- }
-
- // http://dev.eclipse.org/bugs/show_bug.cgi?id=160198
- public void test0657() throws JavaScriptModelException {
- IJavaScriptUnit sourceUnit = getCompilationUnit("Converter" , "src", "test0657", "X.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- IJavaScriptUnit sourceUnit2 = getCompilationUnit("Converter" , "src", "test0657", "A.js"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- class TestASTRequestor extends ASTRequestor {
- public ArrayList asts = new ArrayList();
- public void acceptAST(IJavaScriptUnit source, JavaScriptUnit compilationUnit) {
- this.asts.add(compilationUnit);
- }
- public void acceptBinding(String bindingKey, IBinding binding) {
- }
- }
- TestASTRequestor requestor = new TestASTRequestor();
- resolveASTs(
- new IJavaScriptUnit[] {sourceUnit, sourceUnit2},
- new String[0],
- requestor,
- getJavaProject("Converter"),
- sourceUnit.getOwner()
- );
- ArrayList arrayList = requestor.asts;
- assertEquals("Wrong size", 2, arrayList.size());
- int problemsCount = 0;
- for (int i = 0, max = arrayList.size(); i < max; i++) {
- Object current = arrayList.get(i);
- assertTrue("not a compilation unit", current instanceof JavaScriptUnit);
- JavaScriptUnit unit = (JavaScriptUnit) current;
- IProblem[] problems = unit.getProblems();
- problemsCount += problems.length;
- }
- assertEquals("wrong size", 1, problemsCount);
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=157570
- */
- public void test0658() {
- String src = "public static void m1()\n" +
- " {\n" +
- " int a;\n" +
- " int b;\n" +
- " }\n" +
- "\n" +
- " public static void m2()\n" +
- " {\n" +
- " int c;\n" +
- " int d;\n" +
- " }";
- char[] source = src.toCharArray();
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind (ASTParser.K_STATEMENTS);
- parser.setStatementsRecovery(true);
- parser.setSource (source);
- ASTNode result = parser.createAST (null);
- assertNotNull("no result", result);
- assertEquals("Not a block", ASTNode.BLOCK, result.getNodeType());
- Block block = (Block) result;
- List statements = block.statements();
- assertEquals("Should be empty", 4, statements.size());
- assertTrue("Not recovered", isRecovered(block));
- ASTNode root = block.getRoot();
- assertNotNull("No root", root);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, root.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) root;
- String errors =
- "Syntax error on token(s), misplaced construct(s)\n" +
- "Syntax error, insert \";\" to complete BlockStatements\n" +
- "Syntax error on token(s), misplaced construct(s)\n" +
- "Syntax error, insert \";\" to complete Statement";
- assertProblemsSize(unit, 4, errors);
- }
-
- public void test0659() throws CoreException, JavaScriptModelException {
- IJavaScriptProject javaProject = createJavaProject("P659", new String[] { "src" }, new String[0]);
- try {
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setKind(ASTParser.K_COMPILATION_UNIT);
- parser.setStatementsRecovery(true);
- String source ="package java.lang;\n" +
- "public class Object {\n" +
- " public String toString() {\n" +
- " return \"\";\n" +
- " }\n" +
- "}";
- parser.setSource(source.toCharArray());
- parser.setProject(javaProject);
- parser.setResolveBindings(true);
- parser.setUnitName("Object.js");
- ASTNode result = parser.createAST (null);
- assertNotNull("no result", result);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, result.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) result;
- ASTNode node = getASTNode(unit, 0, 0);
- assertNotNull("No node", node);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, node.getNodeType());
- FunctionDeclaration declaration = (FunctionDeclaration) node;
- Block block = declaration.getBody();
- assertNotNull("no block", block);
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- ReturnStatement returnStatement = (ReturnStatement) statements.get(0);
- Expression expression = returnStatement.getExpression();
- assertNotNull("No expression", expression);
- ITypeBinding binding = expression.resolveTypeBinding();
- assertNull("No binding", binding);
- } finally {
- deleteProject("P659");
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=144858
- * TODO (frederic) check that keys are different (PR 149590)
- */
- public void test0660() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " void foo() {\n" +
- " int x = 0;\n" +
- " String x = \"\"; //$NON-NLS-1$\n" +
- " x.toString();\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 1, "Duplicate local variable x");
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "x", variableBinding.getName());
- // (PR 149590)
- // String key = variableBinding.getKey();
-
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- statement = (VariableDeclarationStatement) node;
- fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "x", variableBinding.getName());
- // (PR 149590)
- // String key2 = variableBinding.getKey();
- //assertFalse("Keys should not be equals", key2.equals(key));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=144858
- * TODO (frederic) check that keys are different (PR 149590)
- */
- public void test0661() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " int x = 2;\n" +
- " try {\n" +
- "\n" +
- " } catch(NullPointerException x) {\n" +
- " } catch(Exception e) {\n" +
- " }\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- assertProblemsSize(unit, 1, "Duplicate parameter x");
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "x", variableBinding.getName());
- // (PR 149590)
- // String key = variableBinding.getKey();
-
- node = getASTNode(unit, 0, 0, 1);
- assertEquals("Not a try statement", ASTNode.TRY_STATEMENT, node.getNodeType());
- TryStatement statement2 = (TryStatement) node;
- List catchClauses = statement2.catchClauses();
- assertEquals("Wrong size", 2, catchClauses.size());
- CatchClause catchClause = (CatchClause) catchClauses.get(0);
- SingleVariableDeclaration variableDeclaration = catchClause.getException();
- variableBinding = variableDeclaration.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "x", variableBinding.getName());
- // (PR 149590)
- // String key2 = variableBinding.getKey();
- //assertFalse("Keys should not be equals", key2.equals(key));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=144858
- * TODO (frederic) check that keys are different (PR 149590)
- */
- public void test0662() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " int x = x = 0;\n" +
- " if (true) {\n" +
- " int x = x = 1;\n" +
- " }\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- String expectedLog =
- "The assignment to variable x has no effect\n" +
- "Duplicate local variable x\n" +
- "The assignment to variable x has no effect";
- assertProblemsSize(unit, 3, expectedLog);
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, node.getNodeType());
- VariableDeclarationStatement statement = (VariableDeclarationStatement) node;
- List fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "x", variableBinding.getName());
- // (PR 149590)
- // String key = variableBinding.getKey();
-
- node = getASTNode(unit, 0, 0, 1);
- assertEquals("Not an if statement", ASTNode.IF_STATEMENT, node.getNodeType());
- IfStatement ifStatement = (IfStatement) node;
- Block block = (Block) ifStatement.getThenStatement();
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- Statement statement2 = (Statement) statements.get(0);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement2.getNodeType());
- statement = (VariableDeclarationStatement) statement2;
- fragments = statement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "x", variableBinding.getName());
-
- // (PR 149590)
- // String key2 = variableBinding.getKey();
- //assertFalse("Keys should not be equals", key2.equals(key));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=144858
- * TODO (frederic) check that keys are different (PR 149590)
- */
- public void test0663() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " public static void main(String[] args) {\n" +
- " for (int i = 0; i < 10; i++) {\n" +
- " for (int i = 0; i < 5; i++) {\n" +
- " // do something\n" +
- " }\n" +
- " }\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- String expectedLog = "Duplicate local variable i";
- assertProblemsSize(unit, 1, expectedLog);
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a for statement", ASTNode.FOR_STATEMENT, node.getNodeType());
- ForStatement statement = (ForStatement) node;
- List initializers = statement.initializers();
- assertEquals("Wrong size", 1, initializers.size());
- Expression expression = (Expression) initializers.get(0);
- assertEquals("Not a variable declaration expression", ASTNode.VARIABLE_DECLARATION_EXPRESSION, expression.getNodeType());
- VariableDeclarationExpression expression2 = (VariableDeclarationExpression) expression;
- List fragments = expression2.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "i", variableBinding.getName());
- // (PR 149590)
- // String key = variableBinding.getKey();
-
- Block block = (Block) statement.getBody();
- List statements = block.statements();
- assertEquals("Wrong size", 1, statements.size());
- Statement statement2 = (Statement) statements.get(0);
- assertEquals("Not a for statement", ASTNode.FOR_STATEMENT, statement2.getNodeType());
- statement = (ForStatement) statement2;
- initializers = statement.initializers();
- assertEquals("Wrong size", 1, initializers.size());
- expression = (Expression) initializers.get(0);
- assertEquals("Not a variable declaration expression", ASTNode.VARIABLE_DECLARATION_EXPRESSION, expression.getNodeType());
- expression2 = (VariableDeclarationExpression) expression;
- fragments = expression2.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- fragment = (VariableDeclarationFragment) fragments.get(0);
- variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "i", variableBinding.getName());
-
- // (PR 149590)
- // String key2 = variableBinding.getKey();
- //assertFalse("Keys should not be equals", key2.equals(key));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=165662
- */
- public void test0664() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " void foo() {\n" +
- " class Local {\n" +
- " void foo() {}\n" +
- " }\n" +
- " {\n" +
- " class Local {\n" +
- " Local(int i) {\n" +
- " this.init(i);\n" +
- " }\n" +
- " void init(int i) {}\n" +
- " }\n" +
- " Local l = new Local(0);\n" +
- " }\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- String expectedLog = "Duplicate nested type Local";
- assertProblemsSize(unit, 1, expectedLog);
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType());
- TypeDeclarationStatement statement = (TypeDeclarationStatement) node;
- ITypeBinding typeBinding = statement.resolveBinding();
- assertNotNull("No binding", typeBinding);
- String key = typeBinding.getKey();
- assertNotNull("No key", key);
-
- node = getASTNode(unit, 0, 0, 1);
- assertEquals("Not a block", ASTNode.BLOCK, node.getNodeType());
- Block block = (Block) node;
- List statements = block.statements();
- assertEquals("wrong size", 2, statements.size());
- Statement statement2 = (Statement) statements.get(0);
- assertEquals("Not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, statement2.getNodeType());
- statement = (TypeDeclarationStatement) statement2;
- typeBinding = statement.resolveBinding();
- assertNotNull("No binding", typeBinding);
- String key2 = typeBinding.getKey();
- assertNotNull("No key2", key2);
- assertFalse("Keys should not be equals", key.equals(key2));
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-
- /**
- * http://dev.eclipse.org/bugs/show_bug.cgi?id=165662
- */
- public void test0665() throws JavaScriptModelException {
- IJavaScriptUnit workingCopy = null;
- try {
- String contents =
- "public class X {\n" +
- " void foo() {\n" +
- " class Local {\n" +
- " void foo() {\n" +
- " }\n" +
- " }\n" +
- " {\n" +
- " class Local {\n" +
- " Local(int i) {\n" +
- " this.init(i);\n" +
- " this.bar();\n" +
- " }\n" +
- " void init(int i) {}\n" +
- " void bar() {\n" +
- " }\n" +
- " }\n" +
- " Local l = new Local(0);\n" +
- " }\n" +
- " Local l = new Local();\n" +
- " l.foo();\n" +
- " }\n" +
- "}";
- workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- ASTNode node = buildAST(
- contents,
- workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit unit = (JavaScriptUnit) node;
- String expectedLog = "Duplicate nested type Local";
- assertProblemsSize(unit, 1, expectedLog);
- node = getASTNode(unit, 0, 0, 0);
- assertEquals("Not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, node.getNodeType());
- TypeDeclarationStatement statement = (TypeDeclarationStatement) node;
- ITypeBinding typeBinding = statement.resolveBinding();
- assertNotNull("No binding", typeBinding);
- String key = typeBinding.getKey();
- assertNotNull("No key", key);
-
- node = getASTNode(unit, 0, 0, 1);
- assertEquals("Not a block", ASTNode.BLOCK, node.getNodeType());
- Block block = (Block) node;
- List statements = block.statements();
- assertEquals("wrong size", 2, statements.size());
- Statement statement2 = (Statement) statements.get(0);
- assertEquals("Not a type declaration statement", ASTNode.TYPE_DECLARATION_STATEMENT, statement2.getNodeType());
- statement = (TypeDeclarationStatement) statement2;
- typeBinding = statement.resolveBinding();
- assertNotNull("No binding", typeBinding);
- String key2 = typeBinding.getKey();
- assertNotNull("No key2", key2);
- assertFalse("Keys should not be equals", key.equals(key2));
-
- Statement statement3 = (Statement) statements.get(1);
- assertEquals("Not a variable declaration statement", ASTNode.VARIABLE_DECLARATION_STATEMENT, statement3.getNodeType());
- VariableDeclarationStatement variableDeclarationStatement = (VariableDeclarationStatement) statement3;
- List fragments = variableDeclarationStatement.fragments();
- assertEquals("Wrong size", 1, fragments.size());
- VariableDeclarationFragment fragment = (VariableDeclarationFragment) fragments.get(0);
- IVariableBinding variableBinding = fragment.resolveBinding();
- assertNotNull("No binding", variableBinding);
- assertEquals("Wrong name", "l", variableBinding.getName());
- Expression expression = fragment.getInitializer();
- ITypeBinding typeBinding2 = expression.resolveTypeBinding();
- assertNotNull("No type binding2", typeBinding2);
-
- AbstractTypeDeclaration declaration = statement.getDeclaration();
- List bodyDeclarations = declaration.bodyDeclarations();
- assertEquals("Wrong size", 3, bodyDeclarations.size());
- BodyDeclaration declaration2 = (BodyDeclaration) bodyDeclarations.get(0);
- assertEquals("Not a method declaration", ASTNode.FUNCTION_DECLARATION, declaration2.getNodeType());
- FunctionDeclaration methodDeclaration = (FunctionDeclaration) declaration2;
- assertTrue("not a constructor", methodDeclaration.isConstructor());
- block = methodDeclaration.getBody();
- statements = block.statements();
- assertEquals("Wrong size", 2, statements.size());
- statement3 = (Statement) statements.get(1);
- assertEquals("Not a expression statement", ASTNode.EXPRESSION_STATEMENT, statement3.getNodeType());
- expression = ((ExpressionStatement) statement3).getExpression();
- assertEquals("Not a method invocation", ASTNode.FUNCTION_INVOCATION, expression.getNodeType());
- FunctionInvocation invocation = (FunctionInvocation) expression;
- IFunctionBinding methodBinding = invocation.resolveMethodBinding();
- assertNotNull(methodBinding);
- } finally {
- if (workingCopy != null)
- workingCopy.discardWorkingCopy();
- }
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTMatcherTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTMatcherTest.java
deleted file mode 100644
index 861606a..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTMatcherTest.java
+++ /dev/null
@@ -1,1112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.lang.reflect.Method;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTMatcher;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.ASTVisitor;
-import org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ArrayAccess;
-import org.eclipse.wst.jsdt.core.dom.ArrayCreation;
-import org.eclipse.wst.jsdt.core.dom.ArrayInitializer;
-import org.eclipse.wst.jsdt.core.dom.ArrayType;
-import org.eclipse.wst.jsdt.core.dom.Assignment;
-import org.eclipse.wst.jsdt.core.dom.Block;
-import org.eclipse.wst.jsdt.core.dom.BlockComment;
-import org.eclipse.wst.jsdt.core.dom.BooleanLiteral;
-import org.eclipse.wst.jsdt.core.dom.BreakStatement;
-import org.eclipse.wst.jsdt.core.dom.CatchClause;
-import org.eclipse.wst.jsdt.core.dom.CharacterLiteral;
-import org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation;
-import org.eclipse.wst.jsdt.core.dom.ConditionalExpression;
-import org.eclipse.wst.jsdt.core.dom.ConstructorInvocation;
-import org.eclipse.wst.jsdt.core.dom.ContinueStatement;
-import org.eclipse.wst.jsdt.core.dom.DoStatement;
-import org.eclipse.wst.jsdt.core.dom.EmptyStatement;
-import org.eclipse.wst.jsdt.core.dom.EnhancedForStatement;
-import org.eclipse.wst.jsdt.core.dom.Expression;
-import org.eclipse.wst.jsdt.core.dom.ExpressionStatement;
-import org.eclipse.wst.jsdt.core.dom.FieldAccess;
-import org.eclipse.wst.jsdt.core.dom.FieldDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ForStatement;
-import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
-import org.eclipse.wst.jsdt.core.dom.FunctionRef;
-import org.eclipse.wst.jsdt.core.dom.FunctionRefParameter;
-import org.eclipse.wst.jsdt.core.dom.IfStatement;
-import org.eclipse.wst.jsdt.core.dom.ImportDeclaration;
-import org.eclipse.wst.jsdt.core.dom.InfixExpression;
-import org.eclipse.wst.jsdt.core.dom.Initializer;
-import org.eclipse.wst.jsdt.core.dom.JSdoc;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.LabeledStatement;
-import org.eclipse.wst.jsdt.core.dom.LineComment;
-import org.eclipse.wst.jsdt.core.dom.MemberRef;
-import org.eclipse.wst.jsdt.core.dom.Modifier;
-import org.eclipse.wst.jsdt.core.dom.Name;
-import org.eclipse.wst.jsdt.core.dom.NullLiteral;
-import org.eclipse.wst.jsdt.core.dom.NumberLiteral;
-import org.eclipse.wst.jsdt.core.dom.PackageDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ParenthesizedExpression;
-import org.eclipse.wst.jsdt.core.dom.PostfixExpression;
-import org.eclipse.wst.jsdt.core.dom.PrefixExpression;
-import org.eclipse.wst.jsdt.core.dom.PrimitiveType;
-import org.eclipse.wst.jsdt.core.dom.QualifiedName;
-import org.eclipse.wst.jsdt.core.dom.QualifiedType;
-import org.eclipse.wst.jsdt.core.dom.ReturnStatement;
-import org.eclipse.wst.jsdt.core.dom.SimpleName;
-import org.eclipse.wst.jsdt.core.dom.SimpleType;
-import org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.wst.jsdt.core.dom.Statement;
-import org.eclipse.wst.jsdt.core.dom.StringLiteral;
-import org.eclipse.wst.jsdt.core.dom.SuperConstructorInvocation;
-import org.eclipse.wst.jsdt.core.dom.SuperFieldAccess;
-import org.eclipse.wst.jsdt.core.dom.SuperMethodInvocation;
-import org.eclipse.wst.jsdt.core.dom.SwitchCase;
-import org.eclipse.wst.jsdt.core.dom.SwitchStatement;
-import org.eclipse.wst.jsdt.core.dom.TagElement;
-import org.eclipse.wst.jsdt.core.dom.TextElement;
-import org.eclipse.wst.jsdt.core.dom.ThisExpression;
-import org.eclipse.wst.jsdt.core.dom.ThrowStatement;
-import org.eclipse.wst.jsdt.core.dom.TryStatement;
-import org.eclipse.wst.jsdt.core.dom.Type;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.TypeLiteral;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.WhileStatement;
-
-/**
- * Test suite for <code>ASTMatcher</code> and <code>ASTNode.subtreeMatch</code>.
- */
-public class ASTMatcherTest extends org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase {
-
- /** @deprecated using deprecated code */
- public static Test suite() {
- // TODO (frederic) use buildList + setAstLevel(init) instead...
- junit.framework.TestSuite suite = new junit.framework.TestSuite(ASTMatcherTest.class.getName());
-
- Class c = ASTMatcherTest.class;
- Method[] methods = c.getMethods();
- for (int i = 0, max = methods.length; i < max; i++) {
- if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
- suite.addTest(new ASTMatcherTest(methods[i].getName(), AST.JLS2));
- suite.addTest(new ASTMatcherTest(methods[i].getName(), AST.JLS3));
- }
- }
- return suite;
- }
-
- AST ast;
- SimpleName N1;
- SimpleName N2;
- SimpleName N3;
- SimpleName N4;
- Expression E1;
- Expression E2;
- Type T1;
- String T1S;
- Type T2;
- String T2S;
- String PT1S;
- Statement S1;
- Statement S2;
- Block B1;
- SingleVariableDeclaration V1;
- SingleVariableDeclaration V2;
- VariableDeclarationFragment W1;
- VariableDeclarationFragment W2;
- FieldDeclaration FD1;
- FieldDeclaration FD2;
- PackageDeclaration PD1;
- ImportDeclaration ID1;
- ImportDeclaration ID2;
- TypeDeclaration TD1;
- TypeDeclaration TD2;
- AnonymousClassDeclaration ACD1;
- JSdoc JD1;
- JSdoc JD2;
- String JD2S;
- String TP1S;
- String TP2S;
- TagElement TAG1;
- TagElement TAG2;
- TextElement TEXT1;
- MemberRef MBREF1;
- FunctionRef MTHREF1;
- FunctionRefParameter MPARM1;
- LineComment LC1;
- BlockComment BC1;
- Modifier MOD1;
- Modifier MOD2;
-
- final StringBuffer b = new StringBuffer();
-
- int API_LEVEL;
-
- public ASTMatcherTest(String name, int apiLevel) {
- super(name);
- this.API_LEVEL = apiLevel;
- }
-
- /**
- * @deprecated (not really - just suppressing the warnings
- * that come from testing Javadoc.getComment())
- *
- */
- protected void setUp() throws Exception {
- super.setUp();
-
- ast = AST.newAST(this.API_LEVEL);
- N1 = ast.newSimpleName("N"); //$NON-NLS-1$
- N2 = ast.newSimpleName("M"); //$NON-NLS-1$
- N3 = ast.newSimpleName("O"); //$NON-NLS-1$
- N4 = ast.newSimpleName("P"); //$NON-NLS-1$
- E1 = ast.newSimpleName("X"); //$NON-NLS-1$
- E2 = ast.newSimpleName("Y"); //$NON-NLS-1$
- T1 = ast.newSimpleType(ast.newSimpleName("Z")); //$NON-NLS-1$
- T1S = "(tS(nSZZnS)tS)"; //$NON-NLS-1$
- T2 = ast.newSimpleType(ast.newSimpleName("Y")); //$NON-NLS-1$
- T2S = "(tS(nSYYnS)tS)"; //$NON-NLS-1$
- S1 = ast.newContinueStatement();
- S2 = ast.newBreakStatement();
- B1 = ast.newBlock();
- V1 = ast.newSingleVariableDeclaration();
- V1.setType(ast.newPrimitiveType(PrimitiveType.INT));
- V1.setName(ast.newSimpleName("a")); //$NON-NLS-1$
- V2 = ast.newSingleVariableDeclaration();
- V2.setType(ast.newPrimitiveType(PrimitiveType.BYTE));
- V2.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- W1 = ast.newVariableDeclarationFragment();
- W1.setName(ast.newSimpleName("a")); //$NON-NLS-1$
- W2 = ast.newVariableDeclarationFragment();
- W2.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- {
- VariableDeclarationFragment temp = ast.newVariableDeclarationFragment();
- temp.setName(ast.newSimpleName("f")); //$NON-NLS-1$
- FD1 = ast.newFieldDeclaration(temp);
- FD1.setType(ast.newPrimitiveType(PrimitiveType.INT));
- }
- {
- VariableDeclarationFragment temp = ast.newVariableDeclarationFragment();
- temp.setName(ast.newSimpleName("g")); //$NON-NLS-1$
- FD2 = ast.newFieldDeclaration(temp);
- FD2.setType(ast.newPrimitiveType(PrimitiveType.CHAR));
- }
- PD1 = ast.newPackageDeclaration();
- PD1.setName(ast.newSimpleName("p")); //$NON-NLS-1$
- ID1 = ast.newImportDeclaration();
- ID1.setName(ast.newSimpleName("i")); //$NON-NLS-1$
- ID2 = ast.newImportDeclaration();
- ID2.setName(ast.newSimpleName("j")); //$NON-NLS-1$
- TD1 = ast.newTypeDeclaration();
- TD1.setName(ast.newSimpleName("c")); //$NON-NLS-1$
- TD2 = ast.newTypeDeclaration();
- TD2.setName(ast.newSimpleName("d")); //$NON-NLS-1$
-
- ACD1 = ast.newAnonymousClassDeclaration();
-
- JD1 = ast.newJSdoc();
- JD2 = ast.newJSdoc();
- if (ast.apiLevel() == AST.JLS2) {
- JD1.setComment("/**X*/"); //$NON-NLS-1$
- JD2.setComment("/**Y*/"); //$NON-NLS-1$
- }
-
- BC1 = ast.newBlockComment();
-
- TAG1 = ast.newTagElement();
- TAG1.setTagName("@foo"); //$NON-NLS-1$
-
- TAG2 = ast.newTagElement();
- TAG2.setTagName("@bar"); //$NON-NLS-1$
-
- TEXT1 = ast.newTextElement();
- TEXT1.setText("foo"); //$NON-NLS-1$
-
- MBREF1 = ast.newMemberRef();
- MBREF1.setName(ast.newSimpleName("p")); //$NON-NLS-1$
-
- MTHREF1 = ast.newFunctionRef();
- MTHREF1.setName(ast.newSimpleName("p")); //$NON-NLS-1$
-
- MPARM1 = ast.newFunctionRefParameter();
- MPARM1.setType(ast.newPrimitiveType(PrimitiveType.CHAR));
-
- if (ast.apiLevel() >= AST.JLS3) {
- PT1S = "[(tM[(tS[(nSZZnS)]tS)]tM)]"; //$NON-NLS-1$
-
- TP1S = "[(tTP[(nSxxnS)]tTP)]"; //$NON-NLS-1$
-
- TP2S = "[(tTP[(nSyynS)]tTP)]"; //$NON-NLS-1$
- LC1 = ast.newLineComment();
-
-
- MOD1 = ast.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD);
- MOD2 = ast.newModifier(Modifier.ModifierKeyword.FINAL_KEYWORD);
-
- }
-
- }
-
- protected void tearDown() throws Exception {
- ast = null;
- super.tearDown();
- }
-
- /** @deprecated using deprecated code */
- public String getName() {
- String name = super.getName();
- switch (this.API_LEVEL) {
- case AST.JLS2:
- name = "JLS2 - " + name;
- break;
- case AST.JLS3:
- name = "JLS3 - " + name;
- break;
- }
- return name;
- }
-
- /**
- * An ASTMatcher that simply records the arguments it is passed,
- * immediately returns a pre-ordained answer, and counts how many
- * times it is called.
- */
- class TestMatcher extends ASTMatcher {
-
- public Object receiverNode;
- public Object otherNode;
- public boolean result;
- public boolean superMatch;
- public boolean superMatchResult;
- public int matchCalls = 0;
-
- TestMatcher() {
- this(false);
- }
-
- TestMatcher(boolean visitDocTags) {
- super(visitDocTags);
- }
-
- boolean standardBody(ASTNode receiver, Object other, boolean matchResult) {
- matchCalls++;
- this.receiverNode = receiver;
- this.otherNode = other;
- this.superMatchResult = matchResult;
- if (superMatch) {
- return this.superMatchResult;
- }
- return this.result;
- }
-
- public boolean match(AnonymousClassDeclaration node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ArrayAccess node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ArrayCreation node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ArrayInitializer node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ArrayType node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(Assignment node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(Block node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(BlockComment node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(BooleanLiteral node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(BreakStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(CatchClause node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(CharacterLiteral node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ClassInstanceCreation node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(JavaScriptUnit node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ConditionalExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ConstructorInvocation node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ContinueStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(DoStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(EmptyStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(EnhancedForStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ExpressionStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(FieldAccess node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(FieldDeclaration node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ForStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(IfStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ImportDeclaration node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(InfixExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(Initializer node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(JSdoc node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(LabeledStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(LineComment node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(MemberRef node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(FunctionDeclaration node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(FunctionInvocation node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(FunctionRef node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(FunctionRefParameter node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(Modifier node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(NullLiteral node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(NumberLiteral node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(PackageDeclaration node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ParenthesizedExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(PostfixExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(PrefixExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(PrimitiveType node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(QualifiedName node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(QualifiedType node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ReturnStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SimpleName node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SimpleType node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SingleVariableDeclaration node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(StringLiteral node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SuperConstructorInvocation node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SuperFieldAccess node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SuperMethodInvocation node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SwitchCase node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(SwitchStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
-
- public boolean match(TagElement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(TextElement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ThisExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(ThrowStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(TryStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(TypeDeclaration node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(TypeDeclarationStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(TypeLiteral node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(VariableDeclarationExpression node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(VariableDeclarationFragment node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(VariableDeclarationStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- public boolean match(WhileStatement node, Object other) {
- return standardBody(node, other, superMatch ? super.match(node, other) : false);
- }
- }
-
- /**
- * AST node visitor that counts the nodes visited.
- */
- static class NodeCounter extends ASTVisitor {
- public NodeCounter(boolean visitDocTags) {
- super(visitDocTags);
- }
-
- public int count = 0;
-
- /* (no javadoc for this method)
- * Method declared on ASTVisitor.
- */
- public void preVisit(ASTNode node) {
- count++;
- }
-
- }
-
- /**
- * Returns the number of AST nodes in the given subtree.
- *
- * @param node the root of the subtree
- * @param visitDocTags true if doc tags should be visited
- * @return the number of nodes (always positive)
- */
- static int nodeCount(ASTNode node, boolean visitDocTags) {
- NodeCounter c = new NodeCounter(visitDocTags);
- node.accept(c);
- return c.count;
- }
-
- /**
- * Checks that the ASTNode.subtreeMatch mechanism is working
- * for a node of a given type.
- */
- void basicMatch(ASTNode node) {
- TestMatcher[] m = {
- new TestMatcher(),
- new TestMatcher(true),
- new TestMatcher(false)};
- for (int i = 0; i < m.length; i++) {
- // check that matcher was called with right arguments
- // and that matches succeed
- TestMatcher m1 = m[i];
- Object o1 = new Object();
- m1.result = true;
- boolean result = node.subtreeMatch(m1, o1);
- assertTrue(m1.matchCalls == 1);
- assertTrue(m1.receiverNode == node);
- assertTrue(m1.otherNode == o1);
- assertTrue(result == true);
- }
-
- m = new TestMatcher[] {
- new TestMatcher(),
- new TestMatcher(true),
- new TestMatcher(false)};
- for (int i = 0; i < m.length; i++) {
- // check that matcher was called with right arguments
- // and that non-matches fail
- TestMatcher m1 = m[i];
- Object o1 = new Object();
- m1.result = false;
- boolean result = node.subtreeMatch(m1, o1);
- assertTrue(m1.matchCalls == 1);
- assertTrue(m1.receiverNode == node);
- assertTrue(m1.otherNode == o1);
- assertTrue(result == false);
- }
-
- // check that ASTMatcher() default implementations delegate
- {
- int count = nodeCount(node, false); // ignore doc tags
- TestMatcher m1 = new TestMatcher();
- m1.superMatch = true;
- boolean result = node.subtreeMatch(m1, node);
- assertTrue(m1.matchCalls == count);
- assertTrue(result == true);
- }
-
- // check that ASTMatcher(false) default implementations delegate
- {
- int count = nodeCount(node, false); // ignore doc tags
- TestMatcher m1 = new TestMatcher(false);
- m1.superMatch = true;
- boolean result = node.subtreeMatch(m1, node);
- assertTrue(m1.matchCalls == count);
- assertTrue(result == true);
- }
-
- // check that ASTMatcher(true) default implementations delegate
- {
- int count = nodeCount(node, true); // include doc tags
- TestMatcher m1 = new TestMatcher(true);
- m1.superMatch = true;
- boolean result = node.subtreeMatch(m1, node);
- assertTrue(m1.matchCalls == count);
- assertTrue(result == true);
- }
-
- }
-
- // NAMES
- public void testSimpleName() {
- Name x1 = ast.newName(new String[]{"Z"}); //$NON-NLS-1$
- basicMatch(x1);
- }
-
- public void testQualifiedName() {
- Name x1 = ast.newName(new String[]{"X", "Y"}); //$NON-NLS-1$ //$NON-NLS-2$
- basicMatch(x1);
- }
-
-
- // TYPES
- public void testPrimitiveType() {
- Type x1 = ast.newPrimitiveType(PrimitiveType.CHAR);
- basicMatch(x1);
- }
-
- public void testSimpleType() {
- Type x1 = ast.newSimpleType(N1);
- basicMatch(x1);
- }
-
- public void testArrayType() {
- Type x0 = ast.newPrimitiveType(PrimitiveType.CHAR);
- Type x1 = ast.newArrayType(x0);
- basicMatch(x1);
- }
-
- /** @deprecated using deprecated code */
- public void testQualifiedType() {
- if (ast.apiLevel() == AST.JLS2) {
- return;
- }
- Type x1 = ast.newQualifiedType(T1, N1);
- basicMatch(x1);
- }
-
- // EXPRESSIONS and STATEMENTS
-
- public void testAnonymousClassDeclaration() {
- AnonymousClassDeclaration x1 = ast.newAnonymousClassDeclaration();
- x1.bodyDeclarations().add(FD1);
- x1.bodyDeclarations().add(FD2);
- basicMatch(x1);
- }
- public void testArrayAccess() {
- ArrayAccess x1 = ast.newArrayAccess();
- x1.setArray(E1);
- x1.setIndex(E2);
- basicMatch(x1);
- }
- public void testArrayCreation() {
- ArrayCreation x1 = ast.newArrayCreation();
- x1.setType(ast.newArrayType(T1));
- x1.dimensions().add(E1);
- x1.dimensions().add(E2);
- x1.setInitializer(ast.newArrayInitializer());
- basicMatch(x1);
- }
- public void testArrayInitializer() {
- ArrayInitializer x1 = ast.newArrayInitializer();
- x1.expressions().add(E1);
- x1.expressions().add(E2);
- basicMatch(x1);
- }
- public void testAssignment() {
- Assignment x1 = ast.newAssignment();
- x1.setLeftHandSide(E1);
- x1.setRightHandSide(E2);
- basicMatch(x1);
- }
- public void testBlock() {
- Block x1 = ast.newBlock();
- x1.statements().add(S1);
- x1.statements().add(S2);
- basicMatch(x1);
- }
-
- public void testBlockComment() {
- BlockComment x1 = ast.newBlockComment();
- basicMatch(x1);
- }
-
- public void testBooleanLiteral() {
- BooleanLiteral x1 = ast.newBooleanLiteral(true);
- basicMatch(x1);
- }
- public void testBreakStatement() {
- BreakStatement x1 = ast.newBreakStatement();
- x1.setLabel(N1);
- basicMatch(x1);
- }
- public void testCatchClause() {
- CatchClause x1 = ast.newCatchClause();
- x1.setException(V1);
- x1.setBody(B1);
- basicMatch(x1);
- }
- public void testCharacterLiteral() {
- CharacterLiteral x1 = ast.newCharacterLiteral();
- x1.setCharValue('q');
- basicMatch(x1);
- }
- /** @deprecated using deprecated code */
- public void testClassInstanceCreation() {
- ClassInstanceCreation x1 = ast.newClassInstanceCreation();
- x1.setExpression(E1);
- if (ast.apiLevel() == AST.JLS2) {
- x1.setName(N1);
- } else {
- x1.setType(T1);
- }
- x1.setAnonymousClassDeclaration(ACD1);
- basicMatch(x1);
- }
- public void testCompilationUnit() {
- JavaScriptUnit x1 = ast.newJavaScriptUnit();
- x1.setPackage(PD1);
- x1.imports().add(ID1);
- x1.imports().add(ID2);
- x1.types().add(TD1);
- x1.types().add(TD2);
- basicMatch(x1);
- }
- public void testConditionalExpression() {
- ConditionalExpression x1 = ast.newConditionalExpression();
- x1.setExpression(E1);
- x1.setThenExpression(E2);
- x1.setElseExpression(N1);
- basicMatch(x1);
- }
- public void testConstructorInvocation() {
- ConstructorInvocation x1 = ast.newConstructorInvocation();
-
- x1.arguments().add(E1);
- x1.arguments().add(E2);
- basicMatch(x1);
- }
- public void testContinueStatement() {
- ContinueStatement x1 = ast.newContinueStatement();
- x1.setLabel(N1);
- basicMatch(x1);
- }
- public void testDoStatement() {
- DoStatement x1 = ast.newDoStatement();
- x1.setExpression(E1);
- x1.setBody(S1);
- basicMatch(x1);
- }
- public void testEmptyStatement() {
- EmptyStatement x1 = ast.newEmptyStatement();
- basicMatch(x1);
- }
- /** @deprecated using deprecated code */
- public void testEnhancedForStatement() {
- if (ast.apiLevel() == AST.JLS2) {
- return;
- }
- EnhancedForStatement x1 = ast.newEnhancedForStatement();
- x1.setParameter(V1);
- x1.setExpression(E1);
- x1.setBody(S1);
- basicMatch(x1);
- }
- public void testExpressionStatement() {
- ExpressionStatement x1 = ast.newExpressionStatement(E1);
- basicMatch(x1);
- }
- public void testFieldAccess() {
- FieldAccess x1 = ast.newFieldAccess();
- x1.setExpression(E1);
- x1.setName(N1);
- basicMatch(x1);
- }
- public void testFieldDeclaration() {
- FieldDeclaration x1 = ast.newFieldDeclaration(W1);
- x1.setJavadoc(JD1);
- if (ast.apiLevel() >= AST.JLS3) {
- x1.modifiers().add(MOD1);
- x1.modifiers().add(MOD2);
- }
- x1.setType(T1);
- x1.fragments().add(W2);
- basicMatch(x1);
- }
- public void testForStatement() {
- ForStatement x1 = ast.newForStatement();
- x1.initializers().add(E1);
- x1.initializers().add(E2);
- x1.setExpression(N1);
- x1.updaters().add(N2);
- x1.updaters().add(N3);
- x1.setBody(S1);
- basicMatch(x1);
- }
- public void testIfStatement() {
- IfStatement x1 = ast.newIfStatement();
- x1.setExpression(E1);
- x1.setThenStatement(S1);
- x1.setElseStatement(S2);
- basicMatch(x1);
- }
- public void testImportDeclaration() {
- ImportDeclaration x1 = ast.newImportDeclaration();
- x1.setName(N1);
- basicMatch(x1);
- }
- public void testInfixExpression() {
- InfixExpression x1 = ast.newInfixExpression();
- x1.setOperator(InfixExpression.Operator.PLUS);
- x1.setLeftOperand(E1);
- x1.setRightOperand(E2);
- x1.extendedOperands().add(N1);
- x1.extendedOperands().add(N2);
- basicMatch(x1);
- }
- public void testInitializer() {
- Initializer x1 = ast.newInitializer();
- x1.setJavadoc(JD1);
- if (ast.apiLevel() >= AST.JLS3) {
- x1.modifiers().add(MOD1);
- x1.modifiers().add(MOD2);
- }
- x1.setBody(B1);
- basicMatch(x1);
- }
- /**
- * @deprecated (not really - just suppressing the warnings
- * that come from testing Javadoc.getComment())
- *
- */
- public void testJavadoc() {
- JSdoc x1 = ast.newJSdoc();
- if (ast.apiLevel() == AST.JLS2) {
- x1.setComment("/**?*/"); //$NON-NLS-1$
- }
- x1.tags().add(TAG1);
- x1.tags().add(TAG2);
- basicMatch(x1);
- }
-
- public void testLabeledStatement() {
- LabeledStatement x1 = ast.newLabeledStatement();
- x1.setLabel(N1);
- x1.setBody(S1);
- basicMatch(x1);
- }
-
- public void testLineComment() {
- LineComment x1 = ast.newLineComment();
- basicMatch(x1);
- }
-
- public void testMemberRef() {
- MemberRef x1 = ast.newMemberRef();
- x1.setQualifier(N1);
- x1.setName(N2);
- basicMatch(x1);
- }
-
- /** @deprecated using deprecated code */
- public void testMethodDeclaration() {
- FunctionDeclaration x1 = ast.newFunctionDeclaration();
- x1.setJavadoc(JD1);
- if (ast.apiLevel() == AST.JLS2) {
- x1.setReturnType(T1);
- } else {
- x1.modifiers().add(MOD1);
- x1.modifiers().add(MOD2);
- x1.setReturnType2(T1);
- }
- x1.setName(N1);
- x1.parameters().add(V1);
- x1.parameters().add(V2);
- x1.thrownExceptions().add(N2);
- x1.thrownExceptions().add(N3);
- x1.setBody(B1);
- basicMatch(x1);
- }
- public void testMethodInvocation() {
- FunctionInvocation x1 = ast.newFunctionInvocation();
- x1.setExpression(N1);
-
- x1.setName(N2);
- x1.arguments().add(E1);
- x1.arguments().add(E2);
- basicMatch(x1);
- }
-
- public void testMethodRef() {
- FunctionRef x1 = ast.newFunctionRef();
- basicMatch(x1);
- x1.setQualifier(N1);
- x1.setName(N2);
- x1.parameters().add(MPARM1);
- }
- public void testMethodRefParameter() {
- FunctionRefParameter x1 = ast.newFunctionRefParameter();
- x1.setType(T1);
- x1.setName(N1);
- basicMatch(x1);
- }
-
- public void testNullLiteral() {
- NullLiteral x1 = ast.newNullLiteral();
- basicMatch(x1);
- }
- public void testNumberLiteral() {
- NumberLiteral x1 = ast.newNumberLiteral("1.0"); //$NON-NLS-1$
- basicMatch(x1);
- }
- public void testParenthesizedExpression() {
- ParenthesizedExpression x1 = ast.newParenthesizedExpression();
- basicMatch(x1);
- }
- public void testPostfixExpression() {
- PostfixExpression x1 = ast.newPostfixExpression();
- x1.setOperand(E1);
- x1.setOperator(PostfixExpression.Operator.INCREMENT);
- basicMatch(x1);
- }
- public void testPrefixExpression() {
- PrefixExpression x1 = ast.newPrefixExpression();
- x1.setOperand(E1);
- x1.setOperator(PrefixExpression.Operator.INCREMENT);
- basicMatch(x1);
- }
- public void testReturnStatement() {
- ReturnStatement x1 = ast.newReturnStatement();
- x1.setExpression(E1);
- basicMatch(x1);
- }
- public void testSingleVariableDeclaration() {
- SingleVariableDeclaration x1 = ast.newSingleVariableDeclaration();
- if (ast.apiLevel() >= AST.JLS3) {
- x1.modifiers().add(MOD1);
- x1.modifiers().add(MOD2);
- }
- x1.setType(T1);
- x1.setName(N1);
- x1.setInitializer(E1);
- basicMatch(x1);
- }
- public void testStringLiteral() {
- StringLiteral x1 = ast.newStringLiteral();
- x1.setLiteralValue("H"); //$NON-NLS-1$
- basicMatch(x1);
- }
- public void testSuperConstructorInvocation() {
- SuperConstructorInvocation x1 = ast.newSuperConstructorInvocation();
- x1.setExpression(N1);
-
- x1.arguments().add(E1);
- x1.arguments().add(E2);
- basicMatch(x1);
- }
- public void testSuperFieldAccess() {
- SuperFieldAccess x1 = ast.newSuperFieldAccess();
- x1.setQualifier(N1);
- x1.setName(N2);
- basicMatch(x1);
- }
- public void testSuperMethodInvocation() {
- SuperMethodInvocation x1 = ast.newSuperMethodInvocation();
- x1.setQualifier(N1);
-
- x1.setName(N2);
- x1.arguments().add(E1);
- x1.arguments().add(E2);
- basicMatch(x1);
- }
- public void testSwitchCase() {
- SwitchCase x1 = ast.newSwitchCase();
- x1.setExpression(E1);
- basicMatch(x1);
- }
- public void testSwitchStatement() {
- SwitchStatement x1 = ast.newSwitchStatement();
- x1.setExpression(E1);
- x1.statements().add(S1);
- x1.statements().add(S2);
- basicMatch(x1);
- }
-
- public void testTagElement() {
- TagElement x1 = ast.newTagElement();
- x1.setTagName("@foo"); //$NON-NLS-1$
- x1.fragments().add(TAG1);
- x1.fragments().add(TEXT1);
- x1.fragments().add(N1);
- x1.fragments().add(MTHREF1);
- basicMatch(x1);
- }
- public void testTextElement() {
- TextElement x1 = ast.newTextElement();
- x1.setText("foo"); //$NON-NLS-1$
- basicMatch(x1);
- }
-
- public void testThisExpression() {
- ThisExpression x1 = ast.newThisExpression();
- x1.setQualifier(N1);
- basicMatch(x1);
- }
- public void testThrowStatement() {
- ThrowStatement x1 = ast.newThrowStatement();
- x1.setExpression(E1);
- basicMatch(x1);
- }
- public void testTryStatement() {
- TryStatement x1 = ast.newTryStatement();
- x1.setBody(B1);
- CatchClause c1 = ast.newCatchClause();
- c1.setException(V1);
- c1.setBody(ast.newBlock());
- x1.catchClauses().add(c1);
- CatchClause c2 = ast.newCatchClause();
- c2.setException(V2);
- c2.setBody(ast.newBlock());
- x1.catchClauses().add(c2);
- x1.setFinally(ast.newBlock());
- basicMatch(x1);
- }
- /** @deprecated using deprecated code */
- public void testTypeDeclaration() {
- TypeDeclaration x1 = ast.newTypeDeclaration();
- x1.setJavadoc(JD1);
- x1.setName(N1);
- if (ast.apiLevel() == AST.JLS2) {
- x1.setSuperclass(N2);
- } else {
- x1.modifiers().add(MOD1);
- x1.modifiers().add(MOD2);
- }
- x1.bodyDeclarations().add(FD1);
- x1.bodyDeclarations().add(FD2);
- basicMatch(x1);
- }
- public void testTypeDeclarationStatement() {
- TypeDeclarationStatement x1 = ast.newTypeDeclarationStatement(TD1);
- basicMatch(x1);
- }
- public void testTypeLiteral() {
- TypeLiteral x1 = ast.newTypeLiteral();
- x1.setType(T1);
- basicMatch(x1);
- }
- public void testVariableDeclarationFragment() {
- VariableDeclarationFragment x1 = ast.newVariableDeclarationFragment();
- x1.setName(N1);
- x1.setInitializer(E1);
- basicMatch(x1);
- }
- public void testVariableDeclarationExpression() {
- VariableDeclarationExpression x1 = ast.newVariableDeclarationExpression(W1);
- if (ast.apiLevel() >= AST.JLS3) {
- x1.modifiers().add(MOD1);
- x1.modifiers().add(MOD2);
- }
- x1.setType(T1);
- x1.fragments().add(W2);
- basicMatch(x1);
- }
- public void testVariableDeclarationStatement() {
- VariableDeclarationStatement x1 = ast.newVariableDeclarationStatement(W1);
- if (ast.apiLevel() >= AST.JLS3) {
- x1.modifiers().add(MOD1);
- x1.modifiers().add(MOD2);
- }
- x1.setType(T1);
- x1.fragments().add(W2);
- basicMatch(x1);
- }
- public void testWhileStatement() {
- WhileStatement x1 = ast.newWhileStatement();
- x1.setExpression(E1);
- x1.setBody(S1);
- basicMatch(x1);
- }
-
-
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTModelBridgeTests.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTModelBridgeTests.java
deleted file mode 100644
index 2642df9..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTModelBridgeTests.java
+++ /dev/null
@@ -1,1419 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.io.IOException;
-
-import junit.framework.Test;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.wst.jsdt.core.IClassFile;
-import org.eclipse.wst.jsdt.core.IJavaScriptElement;
-import org.eclipse.wst.jsdt.core.IJavaScriptProject;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.IType;
-import org.eclipse.wst.jsdt.core.JavaScriptCore;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.WorkingCopyOwner;
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.ASTParser;
-import org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ArrayType;
-import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
-import org.eclipse.wst.jsdt.core.dom.IBinding;
-import org.eclipse.wst.jsdt.core.dom.IFunctionBinding;
-import org.eclipse.wst.jsdt.core.dom.IPackageBinding;
-import org.eclipse.wst.jsdt.core.dom.ITypeBinding;
-import org.eclipse.wst.jsdt.core.dom.QualifiedName;
-import org.eclipse.wst.jsdt.core.dom.SimpleName;
-import org.eclipse.wst.jsdt.core.dom.SuperConstructorInvocation;
-import org.eclipse.wst.jsdt.core.dom.Type;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclaration;
-import org.eclipse.wst.jsdt.core.search.IJavaScriptSearchConstants;
-import org.eclipse.wst.jsdt.core.search.IJavaScriptSearchScope;
-import org.eclipse.wst.jsdt.core.search.SearchEngine;
-import org.eclipse.wst.jsdt.core.tests.model.AbstractJavaSearchTests;
-
-/*
- * Test the bridge between the DOM AST and the Java model.
- */
-public class ASTModelBridgeTests extends AbstractASTTests {
-
- IJavaScriptUnit workingCopy;
-
- public ASTModelBridgeTests(String name) {
- super(name);
- }
-
- public static Test suite() {
- return buildModelTestSuite(ASTModelBridgeTests.class);
- }
-
- // Use this static initializer to specify subset for tests
- // All specified tests which do not belong to the class are skipped...
- static {
-// TESTS_PREFIX = "testBug86380";
-// TESTS_NAMES = new String[] { "testCreateBindings19" };
-// TESTS_NUMBERS = new int[] { 83230 };
-// TESTS_RANGE = new int[] { 83304, -1 };
- }
-
- /*
- * Removes the marker comments "*start*" and "*end*" from the given contents,
- * builds an AST from the resulting source, and returns the AST node that was delimited
- * by "*start*" and "*end*".
- */
- private ASTNode buildAST(String contents) throws JavaScriptModelException {
- return buildAST(contents, this.workingCopy);
- }
-
- private IBinding[] createBindings(String contents, IJavaScriptElement element) throws JavaScriptModelException {
- this.workingCopy.getBuffer().setContents(contents);
- this.workingCopy.makeConsistent(null);
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setProject(getJavaProject("P"));
- IJavaScriptElement[] elements = new IJavaScriptElement[] {element};
- return parser.createBindings(elements, null);
- }
-
- private IBinding[] createBinaryBindings(String contents, IJavaScriptElement element) throws CoreException {
- createClassFile("/P/lib", "A.class", contents);
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setProject(getJavaProject("P"));
- IJavaScriptElement[] elements = new IJavaScriptElement[] {element};
- return parser.createBindings(elements, null);
- }
-
- public void setUpSuite() throws Exception {
- super.setUpSuite();
- setUpJavaProject();
- }
-
- private void setUpJavaProject() throws CoreException, IOException, JavaScriptModelException {
- IJavaScriptProject project = createJavaProject("P", new String[] {"src"}, new String[] {"JCL15_LIB,JCL15_SRC", "/P/lib"}, "bin", "1.5");
- project.setOption(JavaScriptCore.COMPILER_PB_UNUSED_LOCAL, JavaScriptCore.IGNORE);
- project.setOption(JavaScriptCore.COMPILER_PB_UNUSED_PRIVATE_MEMBER, JavaScriptCore.IGNORE);
- project.setOption(JavaScriptCore.COMPILER_PB_FIELD_HIDING, JavaScriptCore.IGNORE);
- project.setOption(JavaScriptCore.COMPILER_PB_LOCAL_VARIABLE_HIDING, JavaScriptCore.IGNORE);
- project.setOption(JavaScriptCore.COMPILER_PB_TYPE_PARAMETER_HIDING, JavaScriptCore.IGNORE);
- project.setOption(JavaScriptCore.COMPILER_PB_RAW_TYPE_REFERENCE, JavaScriptCore.IGNORE);
- addLibrary(
- project,
- "lib.jar",
- "libsrc.zip",
- new String[] {
- "p/Y.js",
- "package p;\n" +
- "public class Y<T> {\n" +
- " public Y(T t) {\n" +
- " }\n" +
- "}",
- "p/Z.js",
- "package p;\n" +
- "public class Z {\n" +
- " /*start*/class Member {\n" +
- " }/*end*/\n" +
- " void foo() {\n" +
- " new Member() {};\n" +
- " }\n" +
- "}",
- "p/W.js",
- "package p;\n" +
- "public class W {\n" +
- " class Member {\n" +
- " /*start*/Member(String s) {\n" +
- " }/*end*/\n" +
- " }\n" +
- "}",
- "p/ABC.js",
- "package p;\n" +
- "public class ABC {\n" +
- "}",
- "Z.js",
- "public class Z {\n" +
- " /*start*/class Member {\n" +
- " }/*end*/\n" +
- " void foo() {\n" +
- " new Member() {};\n" +
- " }\n" +
- "}"
- },
- "1.5");
- this.workingCopy = getCompilationUnit("/P/src/X.js").getWorkingCopy(
- new WorkingCopyOwner() {},
- null/*no progress*/);
- }
-
- public void tearDownSuite() throws Exception {
- tearDownJavaProject();
- super.tearDownSuite();
- }
-
- private void tearDownJavaProject() throws JavaScriptModelException, CoreException {
- if (this.workingCopy != null)
- this.workingCopy.discardWorkingCopy();
- deleteProject("P");
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing an anonymous type is correct.
- */
- public void testAnonymousType() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " Object foo() {\n" +
- " return new Object() /*start*/{\n" +
- " }/*end*/;\n" +
- " }\n" +
- "}"
- );
- IBinding binding = ((AnonymousClassDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "<anonymous #1> [in foo() [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- public void testAnonymousType2() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " public void foo() {\n" +
- " new Y(0/*c*/) /*start*/{\n" +
- " Object field;\n" +
- " }/*end*/;\n" +
- " }\n" +
- "}\n" +
- "class Y {\n" +
- " Y(int i) {\n" +
- " }\n" +
- "}"
- );
- IBinding binding = ((AnonymousClassDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "<anonymous #1> [in foo() [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing an array type is correct.
- */
- public void testArrayType1() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " /*start*/Object[]/*end*/ field;\n" +
- "}"
- );
- IBinding binding = ((ArrayType) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "Object [in Object.class [in java.lang [in "+ getExternalJCLPathString("1.5") + "]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing an array type of base type null.
- * (regression test for bug 100142
- CCE when calling ITypeBinding#getJavaElement() on char[][]
- */
- public void testArrayType2() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " /*start*/char[][]/*end*/ field;\n" +
- "}"
- );
- IBinding binding = ((ArrayType) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "<null>",
- element
- );
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a method coming from a class file is correct.
- * (regression test for bug 91445 IFunctionBinding.getJavaElement() returns an "unopen" IFunction)
- */
- public void testBinaryMethod() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("P", getExternalJCLPathString("1.5"), "java.lang", "Enum.class");
- String source = classFile.getSource();
- MarkerInfo markerInfo = new MarkerInfo(source);
- markerInfo.astStarts = new int[] {source.indexOf("protected Enum")};
- markerInfo.astEnds = new int[] {source.indexOf('}', markerInfo.astStarts[0]) + 1};
- ASTNode node = buildAST(markerInfo, classFile);
- IBinding binding = ((FunctionDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "Enum(java.lang.String, int) [in Enum [in Enum.class [in java.lang [in "+ getExternalJCLPathString("1.5") + "]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a constructor of a binary member type is correct.
- * (regression test for bug 119249 codeResolve, search, etc. don't work on constructor of binary inner class)
- */
- public void testBinaryMemberTypeConstructor() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("P", "/P/lib.jar", "p", "W$Member.class");
- String source = classFile.getSource();
- MarkerInfo markerInfo = new MarkerInfo(source);
- markerInfo.astStarts = new int[] {source.indexOf("/*start*/") + "/*start*/".length()};
- markerInfo.astEnds = new int[] {source.indexOf("/*end*/")};
- ASTNode node = buildAST(markerInfo, classFile);
- IBinding binding = ((FunctionDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "Member(p.W, java.lang.String) [in Member [in W$Member.class [in p [in lib.jar [in P]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a type coming from a class file is correct.
- */
- public void testBinaryType() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("P", getExternalJCLPathString("1.5"), "java.lang", "String.class");
- String source = classFile.getSource();
- MarkerInfo markerInfo = new MarkerInfo(source);
- markerInfo.astStarts = new int[] {source.indexOf("public")};
- markerInfo.astEnds = new int[] {source.lastIndexOf('}') + 1};
- ASTNode node = buildAST(markerInfo, classFile);
- IBinding binding = ((TypeDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "String [in String.class [in java.lang [in "+ getExternalJCLPathString("1.5") + "]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a type coming from a class file is correct
- * after searching for references to this type.
- * (regression test for bug 136016 [refactoring] CCE during Use Supertype refactoring)
- */
- public void testBinaryType2() throws CoreException {
- IClassFile classFile = getClassFile("P", "lib.jar", "p", "ABC.class"); // class with no references
-
- // ensure classfile is open
- classFile.open(null);
-
- //search for references to p.ABC after adding references in exactly 1 file
- try {
- createFile(
- "/P/src/Test.js",
- "import p.ABC;\n" +
- "public class Test extends ABC {\n" +
- "}"
- );
- IJavaScriptSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaScriptElement[] {getPackageFragmentRoot("/P/src")});
- search(classFile.getType(), IJavaScriptSearchConstants.REFERENCES, scope, new AbstractJavaSearchTests.JavaSearchResultCollector());
- } finally {
- deleteFile("/P/src/Test.js");
- }
-
- String source = classFile.getSource();
- MarkerInfo markerInfo = new MarkerInfo(source);
- markerInfo.astStarts = new int[] {source.indexOf("public")};
- markerInfo.astEnds = new int[] {source.lastIndexOf('}') + 1};
- ASTNode node = buildAST(markerInfo, classFile);
- IBinding binding = ((TypeDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "ABC [in ABC.class [in p [in lib.jar [in P]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a type in a jar is correct after deleting the first project
- * referencing it.
- */
- public void testBinaryType3() throws CoreException, IOException {
- // force String to be put in the jar cache
- buildAST(
- "public class X {\n" +
- " /*start*/String/*end*/ field;\n" +
- "}"
- );
- try {
- tearDownJavaProject();
-
- createJavaProject("P1", new String[] {""}, new String[] {"JCL15_LIB"}, "", "1.5");
- createFile(
- "/P1/X.js",
- "public class X {\n" +
- " /*start*/String/*end*/ field;\n" +
- "}"
- );
- ASTNode node = buildAST(getCompilationUnit("/P1/X.js"));
- IBinding binding = ((Type) node).resolveBinding();
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "String [in String.class [in java.lang [in "+ getExternalJCLPathString("1.5") + "]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- } finally {
- deleteProject("P1");
- setUpJavaProject();
- }
- }
-
- /*
- * Ensures that the IJavaScriptElement for a binary member type coming from an anoumous class file is correct.
- * (regression test for bug 100636 [model] Can't find overriden methods of protected nonstatic inner class.)
- */
- public void testBinaryMemberTypeFromAnonymousClassFile1() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("P", "/P/lib.jar", "p", "Z$1.class");
- String source = classFile.getSource();
- MarkerInfo markerInfo = new MarkerInfo(source);
- markerInfo.astStarts = new int[] {source.indexOf("/*start*/") + "/*start*/".length()};
- markerInfo.astEnds = new int[] {source.indexOf("/*end*/")};
- ASTNode node = buildAST(markerInfo, classFile);
- IBinding binding = ((TypeDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "Member [in Z$Member.class [in p [in lib.jar [in P]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement for a binary member type coming from an anoumous class file is correct.
- * (regression test for bug 100636 [model] Can't find overriden methods of protected nonstatic inner class.)
- */
- public void testBinaryMemberTypeFromAnonymousClassFile2() throws JavaScriptModelException {
- IClassFile classFile = getClassFile("P", "/P/lib.jar", "", "Z$1.class");
- String source = classFile.getSource();
- MarkerInfo markerInfo = new MarkerInfo(source);
- markerInfo.astStarts = new int[] {source.indexOf("/*start*/") + "/*start*/".length()};
- markerInfo.astEnds = new int[] {source.indexOf("/*end*/")};
- ASTNode node = buildAST(markerInfo, classFile);
- IBinding binding = ((TypeDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "Member [in Z$Member.class [in <default> [in lib.jar [in P]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (test several kinds of elements)
- */
- public void testCreateBindings01() throws JavaScriptModelException {
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setResolveBindings(true);
- parser.setProject(getJavaProject("P"));
- WorkingCopyOwner owner = new WorkingCopyOwner() {};
- this.workingCopies = new IJavaScriptUnit[3];
- this.workingCopies[0] = getWorkingCopy(
- "/P/src/X.js",
- "public class X {\n" +
- " public void foo(int i, String s) {\n" +
- " }\n" +
- "}",
- owner, false);
- this.workingCopies[1] = getWorkingCopy(
- "/P/src/Y.js",
- "public class Y extends X {\n" +
- " void bar() {\n" +
- " new Y() {};\n" +
- " }\n" +
- "}",
- owner, false);
- this.workingCopies[2] = getWorkingCopy(
- "/P/src/I.js",
- "public interface I {\n" +
- " int BAR;\n" +
- "}",
- owner, false);
- IType typeX = this.workingCopies[0].getType("X");
- IJavaScriptElement[] elements = new IJavaScriptElement[] {
- typeX,
- getClassFile("P", getExternalJCLPathString("1.5"), "java.lang", "Object.class").getType(),
- typeX.getFunction("foo", new String[] {"I", "QString;"}),
- this.workingCopies[2].getType("I").getField("BAR"),
- this.workingCopies[1].getType("Y").getFunction("bar", new String[0]).getType("", 1)
- };
- IBinding[] bindings = parser.createBindings(elements, null);
- assertBindingsEqual(
- "LX;\n" +
- "Ljava/lang/Object;\n" +
- "LX;.foo(ILjava/lang/String;)V\n" +
- "LI;.BAR)I\n" +
- "LY$50;",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (top level type)
- */
- public void testCreateBindings02() throws JavaScriptModelException {
- IBinding[] bindings = createBindings(
- "public class X {\n" +
- "}",
- this.workingCopy.getType("X")
- );
- assertBindingsEqual(
- "LX;",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (member type)
- */
- public void testCreateBindings03() throws JavaScriptModelException {
- IBinding[] bindings = createBindings(
- "public class X {\n" +
- " public class Member {\n" +
- " }\n" +
- "}",
- this.workingCopy.getType("X").getType("Member")
- );
- assertBindingsEqual(
- "LX$Member;",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (anonymous type)
- */
- public void testCreateBindings04() throws JavaScriptModelException {
- IBinding[] bindings = createBindings(
- "public class X {\n" +
- " void foo() {\n" +
- " new X() {\n" +
- " };\n" +
- " }\n" +
- "}",
- this.workingCopy.getType("X").getFunction("foo", new String[0]).getType("", 1)
- );
- assertBindingsEqual(
- "LX$40;",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (local type)
- */
- public void testCreateBindings05() throws JavaScriptModelException {
- IBinding[] bindings = createBindings(
- "public class X {\n" +
- " void foo() {\n" +
- " class Y {\n" +
- " }\n" +
- " }\n" +
- "}",
- this.workingCopy.getType("X").getFunction("foo", new String[0]).getType("Y", 1)
- );
- assertBindingsEqual(
- "LX$42$Y;",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (field)
- */
- public void testCreateBindings06() throws JavaScriptModelException {
- IBinding[] bindings = createBindings(
- "public class X {\n" +
- " int field;\n" +
- "}",
- this.workingCopy.getType("X").getField("field")
- );
- assertBindingsEqual(
- "LX;.field)I",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (method)
- */
- public void testCreateBindings07() throws JavaScriptModelException {
- IBinding[] bindings = createBindings(
- "public class X {\n" +
- " void foo() {}\n" +
- "}",
- this.workingCopy.getType("X").getFunction("foo", new String[0])
- );
- assertBindingsEqual(
- "LX;.foo()V",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (annotation declaration)
- */
- public void testCreateBindings08() throws JavaScriptModelException {
- IBinding[] bindings = createBindings(
- "@interface X {\n" +
- "}",
- this.workingCopy.getType("X")
- );
- assertBindingsEqual(
- "LX;",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (enum declaration)
- */
- public void testCreateBindings09() throws JavaScriptModelException {
- IBinding[] bindings = createBindings(
- "public enum X {\n" +
- "}",
- this.workingCopy.getType("X")
- );
- assertBindingsEqual(
- "LX;",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (annotation member declaration)
- */
- public void testCreateBindings10() throws JavaScriptModelException {
- IBinding[] bindings = createBindings(
- "@interface X {\n" +
- " int foo();\n" +
- "}",
- this.workingCopy.getType("X").getFunction("foo", new String[0])
- );
- assertBindingsEqual(
- "LX;.foo()I",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (enum constant)
- */
- public void testCreateBindings11() throws JavaScriptModelException {
- IBinding[] bindings = createBindings(
- "public enum X {\n" +
- " FOO;\n" +
- "}",
- this.workingCopy.getType("X").getField("FOO")
- );
- assertBindingsEqual(
- "LX;.FOO)LX;",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (import)
- */
- public void testCreateBindings12() throws JavaScriptModelException {
- IBinding[] bindings = createBindings(
- "import java.io.*;\n" +
- "public class X implements Serializable {\n" +
- " static final long serialVersionUID = 0;\n" +
- "}",
- this.workingCopy.getImport("java.io.*")
- );
- assertBindingsEqual(
- "java/io",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (import)
- */
- public void testCreateBindings13() throws JavaScriptModelException {
- IBinding[] bindings = createBindings(
- "import java.io.Serializable;\n" +
- "public class X implements Serializable {\n" +
- " static final long serialVersionUID = 0;\n" +
- "}",
- this.workingCopy.getImport("java.io.Serializable")
- );
- assertBindingsEqual(
- "Ljava/io/Serializable;",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (binary type)
- */
- public void testCreateBindings15() throws CoreException {
- IBinding[] bindings = createBinaryBindings(
- "public class A {\n" +
- "}",
- getClassFile("/P/lib/A.class").getType()
- );
- assertBindingsEqual(
- "LA;",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (binary field)
- */
- public void testCreateBindings16() throws CoreException {
- IBinding[] bindings = createBinaryBindings(
- "public class A {\n" +
- " int field;\n" +
- "}",
- getClassFile("/P/lib/A.class").getType().getField("field")
- );
- assertBindingsEqual(
- "LA;.field)I",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (binary method)
- */
- public void testCreateBindings17() throws CoreException {
- IBinding[] bindings = createBinaryBindings(
- "public class A {\n" +
- " int foo(String s, boolean b) {\n" +
- " return -1;\n" +
- " }\n" +
- "}",
- getClassFile("/P/lib/A.class").getType().getFunction("foo", new String[] {"Ljava.lang.String;", "Z"})
- );
- assertBindingsEqual(
- "LA;.foo(Ljava/lang/String;Z)I",
- bindings);
- }
-
- /*
- * Ensures that the correct IBindings are created for a given set of IJavaScriptElement
- * (binary method)
- * (regression test for bug 122650 ASTParser.createBindings(IJavaScriptElement[]) returns wrong element)
- */
- public void testCreateBindings18() throws CoreException {
- IBinding[] bindings = createBinaryBindings(
- "public class A {\n" +
- " <E> void foo(E e) {\n" +
- " }\n" +
- "}",
- getClassFile("/P/lib/A.class").getType().getFunction("foo", new String[] {"TE;"})
- );
- assertBindingsEqual(
- "LA;.foo<E:Ljava/lang/Object;>(TE;)V",
- bindings);
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a field is correct.
- */
- public void testField1() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " Object /*start*/field/*end*/;\n" +
- "}"
- );
- IBinding binding = ((VariableDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "field [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a field is correct.
- */
- public void testField2() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " Object foo() {\n" +
- " return new Object() {\n" +
- " Object /*start*/field/*end*/;\n" +
- " };\n" +
- " }\n" +
- "}"
- );
- IBinding binding = ((VariableDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "field [in <anonymous #1> [in foo() [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a local type is correct.
- */
- public void testLocalType() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " void foo() {\n" +
- " /*start*/class Y {\n" +
- " }/*end*/\n" +
- " }\n" +
- "}"
- );
- IBinding binding = ((TypeDeclarationStatement) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "Y [in foo() [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a local type
- * and coming from a binding key resolution is correct.
- */
- public void testLocalType2() throws CoreException {
- String filePath = "/P/src/Z.js";
- try {
- String contents =
- "public class Z {\n" +
- " void foo() {\n" +
- " /*start*/class Local {\n" +
- " }/*end*/\n" +
- " }\n" +
- "}";
- createFile(filePath, contents);
-
- // Get the binding key
- ASTNode node = buildAST(contents, getCompilationUnit(filePath));
- IBinding binding = ((TypeDeclarationStatement) node).resolveBinding();
- String bindingKey = binding.getKey();
-
- // Resolve the binding key
- BindingRequestor requestor = new BindingRequestor();
- String[] bindingKeys = new String[] {bindingKey};
- resolveASTs(
- new IJavaScriptUnit[] {},
- bindingKeys,
- requestor,
- getJavaProject("P"),
- workingCopy.getOwner()
- );
- IBinding[] bindings = requestor.getBindings(bindingKeys);
-
- // Ensure the Java element is correct
- IJavaScriptElement element = bindings[0].getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "Local [in foo() [in Z [in Z.java [in <default> [in src [in P]]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- } finally {
- deleteFile(filePath);
- }
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a local variable is correct.
- * (regression test for bug 79610 IVariableBinding#getJavaElement() returns null for local variables)
- */
- public void testLocalVariable1() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " void foo() {\n" +
- " int /*start*/local/*end*/;\n" +
- " }\n" +
- "}"
- );
- IBinding binding = ((VariableDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- IJavaScriptElement expected = getLocalVariable(this.workingCopy, "local", "local");
- assertEquals(
- "Unexpected Java element",
- expected,
- element
- );
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a local variable is correct.
- * (regression test for bug 79610 IVariableBinding#getJavaElement() returns null for local variables)
- */
- public void testLocalVariable2() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " void foo() {\n" +
- " Object first, /*start*/second/*end*/, third;\n" +
- " }\n" +
- "}"
- );
- IBinding binding = ((VariableDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- IJavaScriptElement expected = getLocalVariable(this.workingCopy, "second", "second");
- assertEquals(
- "Unexpected Java element",
- expected,
- element
- );
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a local variable is correct.
- * (regression test for bug 80021 [1.5] CCE in VariableBinding.getJavaElement())
- */
- public void testLocalVariable3() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " void foo(/*start*/int arg/*end*/) {\n" +
- " }\n" +
- "}"
- );
- IBinding binding = ((VariableDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- IJavaScriptElement expected = getLocalVariable(this.workingCopy, "arg", "arg");
- assertEquals(
- "Unexpected Java element",
- expected,
- element
- );
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a member type is correct.
- */
- public void testMemberType() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " /*start*/class Y {\n" +
- " }/*end*/\n" +
- "}"
- );
- IBinding binding = ((TypeDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "Y [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a method is correct.
- */
- public void testMethod01() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X<K, V> {\n" +
- " /*start*/void foo(int i, Object o, java.lang.String s, Class[] c, X<K, V> x) {\n" +
- " }/*end*/\n" +
- "}"
- );
- IBinding binding = ((FunctionDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "foo(int, Object, java.lang.String, Class[], X<K,V>) [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a method is correct.
- */
- public void testMethod02() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X<K, V> {\n" +
- " /*start*/void foo() {\n" +
- " }/*end*/\n" +
- "}"
- );
- IBinding binding = ((FunctionDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "foo() [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a method is correct.
- * (regression test for bug 78757 FunctionBinding.getJavaElement() returns null)
- */
- public void testMethod03() throws JavaScriptModelException {
- IJavaScriptUnit otherWorkingCopy = null;
- try {
- otherWorkingCopy = getWorkingCopy(
- "/P/src/Y.js",
- "public class Y {\n" +
- " void foo(int i, String[] args, java.lang.Class clazz) {}\n" +
- "}",
- this.workingCopy.getOwner(),
- null
- );
- ASTNode node = buildAST(
- "public class X {\n" +
- " void bar() {\n" +
- " Y y = new Y();\n" +
- " /*start*/y.foo(1, new String[0], getClass())/*end*/;\n" +
- " }\n" +
- "}"
- );
- IBinding binding = ((FunctionInvocation) node).resolveMethodBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "foo(int, String[], java.lang.Class) [in Y [in [Working copy] Y.java [in <default> [in src [in P]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- } finally {
- if (otherWorkingCopy != null)
- otherWorkingCopy.discardWorkingCopy();
- }
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a method is correct.
- * (regression test for bug 81258 IFunctionBinding#getJavaElement() is null with inferred method parameterization)
- */
- public void testMethod04() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " void foo() {\n" +
- " /*start*/bar(new B<Object>())/*end*/;\n" +
- " }\n" +
- " <T extends Object> void bar(A<? extends T> arg) {\n" +
- " }\n" +
- "}\n" +
- "class A<T> {\n" +
- "}\n" +
- "class B<T> extends A<T> { \n" +
- "}"
- );
- IBinding binding = ((FunctionInvocation) node).resolveMethodBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "bar(A<? extends T>) [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a parameterized method is correct.
- * (regression test for bug 82382 IFunctionBinding#getJavaElement() for method m(T t) in parameterized type Gen<T> is null)
- */
- public void testMethod05() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X<T> {\n" +
- " void m(T t) { }\n" +
- "}\n" +
- "\n" +
- "class Y {\n" +
- " {\n" +
- " /*start*/new X<String>().m(\"s\")/*end*/;\n" +
- " }\n" +
- "}"
- );
- IBinding binding = ((FunctionInvocation) node).resolveMethodBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "m(T) [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a method inside an annotation is correct.
- * (regression test for bug 83300 [1.5] ClassCastException in #getJavaElement() on binding of annotation element)
- */
- public void testMethod06() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "@X(/*start*/value/*end*/=\"Hello\", count=-1)\n" +
- "@interface X {\n" +
- " String value();\n" +
- " int count();\n" +
- "}"
- );
- IBinding binding = ((SimpleName) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "value() [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a method with array parameters is correct.
- * (regression test for bug 88769 IFunctionBinding#getJavaElement() drops extra array dimensions and varargs
- */
- public void testMethod07() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " /*start*/public int[] bar(int a[]) {\n" +
- " return a;\n" +
- " }/*end*/\n" +
- "}"
- );
- IBinding binding = ((FunctionDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "bar(int[]) [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a method with array parameters is correct.
- * (regression test for bug 88769 IFunctionBinding#getJavaElement() drops extra array dimensions and varargs
- */
- public void testMethod08() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " /*start*/public Object[] bar2(Object[] o[][]) [][] {\n" +
- " return o;\n" +
- " }/*end*/\n" +
- "}"
- );
- IBinding binding = ((FunctionDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "bar2(Object[][][]) [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a method with varargs parameters is correct.
- * (regression test for bug 88769 IFunctionBinding#getJavaElement() drops extra array dimensions and varargs
- */
- public void testMethod09() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " /*start*/public void bar3(Object... objs) {\n" +
- " }/*end*/\n" +
- "}"
- );
- IBinding binding = ((FunctionDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "bar3(Object[]) [in X [in [Working copy] X.java [in <default> [in src [in P]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that getting the IJavaScriptElement of an IBinding representing a method in an anonymous type
- * doesn't throw a ClassCastException if there is a syntax error.
- * (regression test for bug 149853 CCE in IFunctionBinding#getJavaElement() for recovered anonymous type)
- */
- public void testMethod10() throws CoreException {
- try {
- // use a compilation unit instead of a working copy to use the ASTParser instead of reconcile
- createFile(
- "/P/src/Test.js",
- "public class X {\n" +
- " void test() {\n" +
- " new Object() {\n" +
- " /*start*/public void yes() {\n" +
- " System.out.println(\"hello world\");\n" +
- " }/*end*/\n" +
- " } // missing semicolon;\n" +
- " }\n" +
- "}"
- );
- IJavaScriptUnit cu = getCompilationUnit("/P/src/Test.js");
-
- ASTNode node = buildAST(null/*use existing contents*/, cu, false/*don't report errors*/, true/*statement recovery*/);
- IBinding binding = ((FunctionDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "yes() [in <anonymous #1> [in test() [in X [in Test.java [in <default> [in src [in P]]]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- } finally {
- deleteFile("/P/src/Test.js");
- }
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a package is correct.
- */
- public void testPackage1() throws CoreException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " /*start*/java.lang/*end*/.String field;\n" +
- "}"
- );
- IBinding binding = ((QualifiedName) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "java.lang [in "+ getExternalJCLPathString("1.5") + "]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a package is correct
- * (case of default package)
- */
- public void testPackage2() throws CoreException {
- ASTNode node = buildAST(
- "/*start*/public class X {\n" +
- "}/*end*/"
- );
- ITypeBinding typeBinding = ((TypeDeclaration) node).resolveBinding();
- assertNotNull("No binding", typeBinding);
- IPackageBinding binding = typeBinding.getPackage();
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "<default> [in src [in P]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a parameterized binary type is correct.
- * (regression test for bug 78087 [dom] TypeBinding#getJavaElement() throws IllegalArgumentException for parameterized or raw reference to binary type)
- */
- public void testParameterizedBinaryType() throws CoreException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " /*start*/Comparable<String>/*end*/ field;\n" +
- "}"
- );
- IBinding binding = ((Type) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "Comparable [in Comparable.class [in java.lang [in "+ getExternalJCLPathString("1.5") + "]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a parameterized binary method is correct.
- * (regression test for bug 88892 [1.5] IFunctionBinding#getJavaElement() returns nonexistent IMethods (wrong parameter types))
- */
- public void testParameterizedBinaryMethod() throws CoreException {
- ASTNode node = buildAST(
- "public class X extends p.Y<String> {\n" +
- " public X(String s) {\n" +
- " /*start*/super(s);/*end*/\n" +
- " }\n" +
- "}"
- );
- IBinding binding = ((SuperConstructorInvocation) node).resolveConstructorBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "Y(T) [in Y [in Y.class [in p [in lib.jar [in P]]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a raw binary type is correct.
- * (regression test for bug 78087 [dom] TypeBinding#getJavaElement() throws IllegalArgumentException for parameterized or raw reference to binary type)
- */
- public void testRawBinaryType() throws CoreException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " /*start*/Comparable/*end*/ field;\n" +
- "}"
- );
- IBinding binding = ((Type) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "Comparable [in Comparable.class [in java.lang [in "+ getExternalJCLPathString("1.5") + "]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a top level type is correct.
- */
- public void testTopLevelType1() throws JavaScriptModelException {
- ASTNode node = buildAST(
- "/*start*/public class X {\n" +
- "}/*end*/"
- );
- IBinding binding = ((TypeDeclaration) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "X [in [Working copy] X.java [in <default> [in src [in P]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a top level type is correct
- * (the top level type being in another compilation unit)
- */
- public void testTopLevelType2() throws CoreException {
- try {
- createFile(
- "/P/src/Y.js",
- "public class Y {\n" +
- "}"
- );
- ASTNode node = buildAST(
- "public class X extends /*start*/Y/*end*/ {\n" +
- "}"
- );
- IBinding binding = ((Type) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "Y [in Y.java [in <default> [in src [in P]]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- } finally {
- deleteFile("/P/src/Y.js");
- }
- }
-
- /*
- * Ensures that the IJavaScriptElement of an IBinding representing a top level type is correct
- * (the top level type being in a jar)
- */
- public void testTopLevelType3() throws CoreException {
- ASTNode node = buildAST(
- "public class X {\n" +
- " /*start*/String/*end*/ field;\n" +
- "}"
- );
- IBinding binding = ((Type) node).resolveBinding();
- assertNotNull("No binding", binding);
- IJavaScriptElement element = binding.getJavaElement();
- assertElementEquals(
- "Unexpected Java element",
- "String [in String.class [in java.lang [in "+ getExternalJCLPathString("1.5") + "]]]",
- element
- );
- assertTrue("Element should exist", element.exists());
- }
-
- /*
- * https://bugs.eclipse.org/bugs/show_bug.cgi?id=160637
- */
- public void testCreateBindings19() throws CoreException {
- IBinding[] bindings = createBinaryBindings(
- "public class A {\n" +
- " String foo(String s) {\n" +
- " return null;\n" +
- " }\n" +
- "}",
- getClassFile("/P/lib/A.class").getType().getFunction("foo", new String[] {"Ljava.lang.String;"})
- );
- assertNotNull("No bindings", bindings);
- assertEquals("Wrong size", 1, bindings.length);
- assertTrue("Not a method binding", bindings[0] instanceof IFunctionBinding);
- assertBindingsEqual(
- "LA;.foo(Ljava/lang/String;)Ljava/lang/String;",
- bindings);
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTNodesCollectorVisitor.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTNodesCollectorVisitor.java
deleted file mode 100644
index 2b9ec0e..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTNodesCollectorVisitor.java
+++ /dev/null
@@ -1,260 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.ASTVisitor;
-import org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation;
-import org.eclipse.wst.jsdt.core.dom.FieldAccess;
-import org.eclipse.wst.jsdt.core.dom.FieldDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
-import org.eclipse.wst.jsdt.core.dom.FunctionRef;
-import org.eclipse.wst.jsdt.core.dom.ImportDeclaration;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.MemberRef;
-import org.eclipse.wst.jsdt.core.dom.PackageDeclaration;
-import org.eclipse.wst.jsdt.core.dom.QualifiedName;
-import org.eclipse.wst.jsdt.core.dom.SimpleName;
-import org.eclipse.wst.jsdt.core.dom.SimpleType;
-import org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.wst.jsdt.core.dom.SuperFieldAccess;
-import org.eclipse.wst.jsdt.core.dom.SuperMethodInvocation;
-import org.eclipse.wst.jsdt.core.dom.ThisExpression;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement;
-
-class ASTNodesCollectorVisitor extends ASTVisitor {
-
- private Set detachedAstNodes;
-
- /**
- *
- * @see java.lang.Object#Object()
- */
- ASTNodesCollectorVisitor() {
- // visit Javadoc.tags()
- super(true);
- this.detachedAstNodes = new HashSet();
- }
-
- private void add(ASTNode node) {
- this.detachedAstNodes.add(node);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration)
- */
- public void endVisit(AnonymousClassDeclaration node) {
- add(node);
- detachedListElement(node.bodyDeclarations());
- }
-
- private void detachedListElement(List list) {
- for (int i = 0; i < list.size(); i++) {
- list.remove(0);
- }
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation)
- * @deprecated using deprecated code
- */
- public void endVisit(ClassInstanceCreation node) {
- if (node.getAST().apiLevel() == AST.JLS2) {
- node.setName(
- node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.JavaScriptUnit)
- */
- public void endVisit(JavaScriptUnit node) {
- detachedListElement(node.imports());
- node.setPackage(node.getAST().newPackageDeclaration());
- }
-
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.FieldAccess)
- */
- public void endVisit(FieldAccess node) {
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.FieldDeclaration)
- */
- public void endVisit(FieldDeclaration node) {
- detachedListElement(node.fragments());
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.ImportDeclaration)
- */
- public void endVisit(ImportDeclaration node) {
- add(node);
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see ASTVisitor#endVisit(MemberRef)
- * @since 3.0
- */
- public void endVisit(MemberRef node) {
- add(node);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.FunctionDeclaration)
- */
- public void endVisit(FunctionDeclaration node) {
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.FunctionInvocation)
- */
- public void endVisit(FunctionInvocation node) {
- add(node);
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see ASTVisitor#endVisit(FunctionRef)
- * @since 3.0
- */
- public void endVisit(FunctionRef node) {
- add(node);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.PackageDeclaration)
- */
- public void endVisit(PackageDeclaration node) {
- add(node);
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.QualifiedName)
- */
- public void endVisit(QualifiedName node) {
- add(node);
- node.setQualifier(node.getAST().newSimpleName("sss")); //$NON-NLS-1$
- node.setName(node.getAST().newSimpleName("sss")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.SimpleName)
- */
- public void endVisit(SimpleName node) {
- ASTNode parent = node.getParent();
- switch(parent.getNodeType()) {
- case ASTNode.CONTINUE_STATEMENT :
- case ASTNode.BREAK_STATEMENT :
- case ASTNode.LABELED_STATEMENT :
- break;
- default :
- add(node);
- }
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.SimpleType)
- */
- public void endVisit(SimpleType node) {
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration)
- */
- public void endVisit(SingleVariableDeclaration node) {
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.SuperFieldAccess)
- */
- public void endVisit(SuperFieldAccess node) {
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- node.setQualifier(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.SuperMethodInvocation)
- */
- public void endVisit(SuperMethodInvocation node) {
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- node.setQualifier(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.ThisExpression)
- */
- public void endVisit(ThisExpression node) {
- node.setQualifier(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.TypeDeclaration)
- * @deprecated using deprecated code
- */
- public void endVisit(TypeDeclaration node) {
- add(node);
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- if (node.getAST().apiLevel() == AST.JLS2) {
- node.setSuperclass(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
- detachedListElement(node.bodyDeclarations());
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression)
- */
- public void endVisit(VariableDeclarationExpression node) {
- detachedListElement(node.fragments());
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment)
- */
- public void endVisit(VariableDeclarationFragment node) {
- add(node);
- node.setName(node.getAST().newSimpleName("XXX")); //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTVisitor#endVisit(org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement)
- */
- public void endVisit(VariableDeclarationStatement node) {
- detachedListElement(node.fragments());
- }
-
- /**
- * Returns the detachedAstNodes.
- * @return Set
- */
- public Set getDetachedAstNodes() {
- return detachedAstNodes;
- }
-
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTParserTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTParserTest.java
deleted file mode 100644
index 52c580e..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTParserTest.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.lang.reflect.Method;
-import java.util.HashMap;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.IClassFile;
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTParser;
-
-public class ASTParserTest extends org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase {
-
- /** @deprecated using deprecated code */
- public static Test suite() {
- // TODO (frederic) use buildList + setAstLevel(init) instead...
- junit.framework.TestSuite suite = new junit.framework.TestSuite(ASTParserTest.class.getName());
-
- Class c = ASTParserTest.class;
- Method[] methods = c.getMethods();
- for (int i = 0, max = methods.length; i < max; i++) {
- if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
- suite.addTest(new ASTParserTest(methods[i].getName(), AST.JLS2));
- //suite.addTest(new ASTParserTest(methods[i].getName(), AST.JLS3));
- }
- }
- return suite;
- }
-
- AST ast;
- ASTParser parser;
- int API_LEVEL;
-
- public ASTParserTest(String name, int apiLevel) {
- super(name);
- this.API_LEVEL = apiLevel;
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- ast = AST.newAST(this.API_LEVEL);
- parser = ASTParser.newParser(this.API_LEVEL);
- }
-
- protected void tearDown() throws Exception {
- ast = null;
- super.tearDown();
- }
-
- /** @deprecated using deprecated code */
- public String getName() {
- String name = super.getName();
- switch (this.API_LEVEL) {
- case AST.JLS2:
- name = "JLS2 - " + name;
- break;
- case AST.JLS3:
- name = "JLS3 - " + name;
- break;
- }
- return name;
- }
-
- public void testKConstants() {
- assertTrue(ASTParser.K_EXPRESSION == 1);
- assertTrue(ASTParser.K_STATEMENTS == 2);
- assertTrue(ASTParser.K_CLASS_BODY_DECLARATIONS == 4);
- assertTrue(ASTParser.K_COMPILATION_UNIT == 8);
- }
-
- public void testSetting() {
- // for now, just slam some values in
- parser.setKind(ASTParser.K_COMPILATION_UNIT);
- parser.setKind(ASTParser.K_CLASS_BODY_DECLARATIONS);
- parser.setKind(ASTParser.K_EXPRESSION);
- parser.setKind(ASTParser.K_STATEMENTS);
-
- parser.setSource(new char[0]);
- parser.setSource((char[]) null);
- parser.setSource((IJavaScriptUnit) null);
- parser.setSource((IClassFile) null);
-
- parser.setResolveBindings(false);
- parser.setResolveBindings(true);
-
- parser.setSourceRange(0, -1);
- parser.setSourceRange(0, 1);
- parser.setSourceRange(1, 0);
- parser.setSourceRange(1, -1);
-
- parser.setWorkingCopyOwner(null);
-
- parser.setUnitName(null);
- parser.setUnitName("Foo.js"); //$NON-NLS-1$
-
- parser.setProject(null);
-
- parser.setFocalPosition(-1);
- parser.setFocalPosition(0);
-
- parser.setCompilerOptions(null);
- parser.setCompilerOptions(new HashMap());
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTPositionsTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTPositionsTest.java
deleted file mode 100644
index e95775a..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTPositionsTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.IJavaScriptUnit;
-import org.eclipse.wst.jsdt.core.JavaScriptModelException;
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-
-public class ASTPositionsTest extends ConverterTestSetup {
-
- IJavaScriptUnit workingCopy;
-
- public void setUpSuite() throws Exception {
- super.setUpSuite();
- this.ast = AST.newAST(AST.JLS3);
- }
-
- public ASTPositionsTest(String name) {
- super(name);
- }
-
- public static Test suite() {
- return buildModelTestSuite(ASTPositionsTest.class);
- }
-
- private void sanityCheck(final String contents, JavaScriptUnit compilationUnit) {
- for (int i = 0, max = contents.length(); i < max; i++) {
- final int lineNumber = compilationUnit.getLineNumber(i);
- assertTrue("Wrong value for char at " + i, lineNumber >= 1);
- final int columnNumber = compilationUnit.getColumnNumber(i);
- assertTrue("Wrong value for char at " + i, columnNumber >= 0);
- final int position = compilationUnit.getPosition(lineNumber, columnNumber);
- assertTrue("Wrong value for char at i", position >= 0);
- if (position == 0) {
- assertEquals("Only true for first character", 0, i);
- }
- assertEquals("Wrong char", contents.charAt(i), contents.charAt(position));
- }
- }
-
- protected void tearDown() throws Exception {
- super.tearDown();
- if (this.workingCopy != null) {
- this.workingCopy.discardWorkingCopy();
- this.workingCopy = null;
- }
- }
-
- public void test001() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- final String contents =
- "var d = new Date();\r\n" +
- "function X() {\r\n" +
- " var date= d;\r\n" +
- "}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals("Wrong char", 'X', contents.charAt(compilationUnit.getPosition(2, 9)));
- assertEquals("Wrong char", 'v', contents.charAt(compilationUnit.getPosition(1, 0)));
- assertEquals("Wrong position", -1, compilationUnit.getPosition(1, -1));
- assertEquals("Wrong position", -1, compilationUnit.getPosition(-1, 0));
- assertEquals("Wrong position", -1, compilationUnit.getPosition(5, 0));
- assertEquals("Wrong position", -1, compilationUnit.getPosition(4, 1));
- assertEquals("Wrong char", '}', contents.charAt(compilationUnit.getPosition(4, 0)));
- assertEquals("Wrong char", '\r', contents.charAt(compilationUnit.getPosition(1, 19)));
-
- sanityCheck(contents, compilationUnit);
- }
-
- public void test002() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- final String contents =
- "function X() {\n" +
- " var map= null;\n" +
- "}\n";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- sanityCheck(contents, compilationUnit);
- }
-
- public void test003() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- final String contents =
- "function X() {\r" +
- " var map= null;\r" +
- "}\r";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- sanityCheck(contents, compilationUnit);
- }
-
- public void test004() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- String contents =
- "function X() {}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- sanityCheck(contents, compilationUnit);
- assertEquals(1, compilationUnit.getLineNumber(0));
- }
-
- public void test005() throws JavaScriptModelException {
- this.workingCopy = getWorkingCopy("/Converter/src/X.js", true/*resolve*/);
- String contents =
- "function X() {}";
- ASTNode node = buildAST(
- contents,
- this.workingCopy,
- false);
- assertEquals("Not a compilation unit", ASTNode.JAVASCRIPT_UNIT, node.getNodeType());
- JavaScriptUnit compilationUnit = (JavaScriptUnit) node;
- assertEquals(1, compilationUnit.getLineNumber(0));
- sanityCheck(contents, compilationUnit);
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTStructuralPropertyTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTStructuralPropertyTest.java
deleted file mode 100644
index 13eab69..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTStructuralPropertyTest.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.dom.*;
-
-public class ASTStructuralPropertyTest extends org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase {
-
- /** @deprecated using deprecated code */
- public static Test suite() {
- // TODO (frederic) use buildList + setAstLevel(init) instead...
- junit.framework.TestSuite suite = new junit.framework.TestSuite(ASTStructuralPropertyTest.class.getName());
-
- Class c = ASTStructuralPropertyTest.class;
- Method[] methods = c.getMethods();
- for (int i = 0, max = methods.length; i < max; i++) {
- if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
- suite.addTest(new ASTStructuralPropertyTest(methods[i].getName(), AST.JLS2));
- suite.addTest(new ASTStructuralPropertyTest(methods[i].getName(), AST.JLS3));
- }
- }
- return suite;
- }
-
- AST ast;
- ASTParser parser;
- int API_LEVEL;
-
- public ASTStructuralPropertyTest(String name, int apiLevel) {
- super(name);
- this.API_LEVEL = apiLevel;
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- ast = AST.newAST(this.API_LEVEL);
- parser = ASTParser.newParser(this.API_LEVEL);
- }
-
- protected void tearDown() throws Exception {
- ast = null;
- super.tearDown();
- }
-
- /** @deprecated using deprecated code */
- public String getName() {
- String name = super.getName();
- switch (this.API_LEVEL) {
- case AST.JLS2:
- name = "JLS2 - " + name;
- break;
- case AST.JLS3:
- name = "JLS3 - " + name;
- break;
- }
- return name;
- }
-
- public void testLocationInParent() {
- final ASTNode root = SampleASTs.oneOfEach(ast);
- ASTVisitor v = new ASTVisitor(true) {
- public void postVisit(ASTNode node) {
- StructuralPropertyDescriptor me = node.getLocationInParent();
- assertTrue(me != null || (node == root));
- ASTNode p = node.getParent();
- if (p != null) {
- List parentProperties = p.structuralPropertiesForType();
- boolean foundMe = false;
- for (Iterator it = parentProperties.iterator(); it
- .hasNext();) {
- StructuralPropertyDescriptor prop =
- (StructuralPropertyDescriptor) it.next();
- if (me == prop || prop.getId().equals(me.getId())) {
- foundMe = true;
- break;
- }
- }
- assertTrue(foundMe);
- }
- }
- };
- root.accept(v);
- }
-
- /**
- * @deprecated since using deprecated constant
- */
- public void testStructuralProperties() {
- final ASTNode root = SampleASTs.oneOfEach(ast);
-
- final Set simpleProperties = new HashSet(400);
- final Set childProperties = new HashSet(400);
- final Set childListProperties = new HashSet(400);
- final Set visitedProperties = new HashSet(400);
- final Set nodeClasses = new HashSet(100);
-
- ASTVisitor v = new ASTVisitor(true) {
- public void postVisit(ASTNode node) {
- StructuralPropertyDescriptor me = node.getLocationInParent();
- if (me != null) {
- visitedProperties.add(me);
- }
- visitedProperties.add(me);
- nodeClasses.add(node.getClass());
- List ps = node.structuralPropertiesForType();
- for (Iterator it = ps.iterator(); it.hasNext(); ) {
- StructuralPropertyDescriptor p = (StructuralPropertyDescriptor) it.next();
- Object o = node.getStructuralProperty(p);
- if (p.isSimpleProperty()) {
- simpleProperties.add(p);
- // slam simple properties
- node.setStructuralProperty(p, o);
- } else if (p.isChildProperty()) {
- childProperties.add(p);
- // replace child with a copy
- ASTNode copy = ASTNode.copySubtree(ast, (ASTNode) o);
- node.setStructuralProperty(p, copy);
- } else if (p.isChildListProperty()) {
- childListProperties.add(p);
- // replace child list with copies
- List list = (List) o;
- List copy = ASTNode.copySubtrees(ast, list);
- list.clear();
- list.addAll(copy);
- }
- }
- }
- };
- root.accept(v);
- switch(this.API_LEVEL) {
- case AST.JLS2 :
- assertEquals("Wrong number of visited node classes", 67, nodeClasses.size());
- assertEquals("Wrong number of visited properties", 82, visitedProperties.size());
- assertEquals("Wrong number of simple properties", 26, simpleProperties.size());
- assertEquals("Wrong number of child properties", 90, childProperties.size());
- assertEquals("Wrong number of child list properties", 26, childListProperties.size());
- break;
- case AST.JLS3 :
- assertEquals("Wrong number of visited node classes", 80, nodeClasses.size());
- assertEquals("Wrong number of visited properties", 104, visitedProperties.size());
- assertEquals("Wrong number of simple properties", 23, simpleProperties.size());
- assertEquals("Wrong number of child properties", 115, childProperties.size());
- assertEquals("Wrong number of child list properties", 52, childListProperties.size());
- }
- // visit should rebuild tree
- ASTNode newRoot = SampleASTs.oneOfEach(ast);
- assertTrue(root.subtreeMatch(new ASTMatcher(), newRoot));
- }
-
- public void testProtect() {
- final ASTNode root = SampleASTs.oneOfEach(ast);
-
- // check that all properties are again modifiable
- class Slammer extends ASTVisitor {
- boolean shouldBeProtected;
- Slammer(boolean shouldBeProtected){
- super(true); // visit doc
- this.shouldBeProtected = shouldBeProtected;
- }
- public void postVisit(ASTNode node) {
- try {
- node.setSourceRange(1, 1);
- assertTrue(!shouldBeProtected);
- } catch (RuntimeException e) {
- assertTrue(shouldBeProtected);
- }
- List ps = node.structuralPropertiesForType();
- for (Iterator it = ps.iterator(); it.hasNext(); ) {
- StructuralPropertyDescriptor p = (StructuralPropertyDescriptor) it.next();
- Object o = node.getStructuralProperty(p);
- if (p.isSimpleProperty()) {
- // slam simple properties
- try {
- node.setStructuralProperty(p, o);
- assertTrue(!shouldBeProtected);
- } catch (RuntimeException e) {
- assertTrue(shouldBeProtected);
- }
- } else if (p.isChildProperty()) {
- // replace child with a copy
- ASTNode copy = ASTNode.copySubtree(ast, (ASTNode) o);
- try {
- node.setStructuralProperty(p, copy);
- assertTrue(!shouldBeProtected);
- } catch (RuntimeException e) {
- assertTrue(shouldBeProtected);
- }
- } else if (p.isChildListProperty()) {
- // replace child list with copies
- List list = (List) o;
- List copy = ASTNode.copySubtrees(ast, list);
- if (!list.isEmpty()) {
- try {
- list.clear();
- assertTrue(!shouldBeProtected);
- } catch (RuntimeException e) {
- assertTrue(shouldBeProtected);
- }
- try {
- list.addAll(copy);
- assertTrue(!shouldBeProtected);
- } catch (RuntimeException e) {
- assertTrue(shouldBeProtected);
- }
- }
- }
- }
- }
- }
-
- class Protector extends ASTVisitor {
- boolean shouldBeProtected;
- Protector(boolean shouldBeProtected){
- super(true); // visit doc
- this.shouldBeProtected = shouldBeProtected;
- }
- public void preVisit(ASTNode node) {
- int f = node.getFlags();
- if (shouldBeProtected) {
- f |= ASTNode.PROTECT;
- } else {
- f &= ~ASTNode.PROTECT;
- }
- node.setFlags(f);
- }
- }
-
-
- // mark all nodes as protected
- root.accept(new Protector(true));
- root.accept(new Slammer(true));
-
- // mark all nodes as unprotected
- root.accept(new Protector(false));
- root.accept(new Slammer(false));
- }
-
- public void testDelete() {
- final ASTNode root = SampleASTs.oneOfEach(ast);
-
- // check that nodes can be deleted unless mandatory
- root.accept(new ASTVisitor(true) {
- public void postVisit(ASTNode node) {
- List ps = node.structuralPropertiesForType();
- for (Iterator it = ps.iterator(); it.hasNext(); ) {
- StructuralPropertyDescriptor p = (StructuralPropertyDescriptor) it.next();
- if (p.isChildProperty()) {
- ChildPropertyDescriptor c = (ChildPropertyDescriptor) p;
- ASTNode child = (ASTNode) node.getStructuralProperty(c);
- if (!c.isMandatory() && child != null) {
- try {
- child.delete();
- assertTrue(node.getStructuralProperty(c) == null);
- } catch (RuntimeException e) {
- assertTrue(false);
- }
- }
- } else if (p.isChildListProperty()) {
- // replace child list with copies
- List list = (List) node.getStructuralProperty(p);
- // iterate over a copy and try removing all members
- List copy = new ArrayList();
- copy.addAll(list);
- for (Iterator it2 = copy.iterator(); it2.hasNext(); ) {
- ASTNode n = (ASTNode) it2.next();
- try {
- n.delete();
- assertTrue(!list.contains(n));
- } catch (RuntimeException e) {
- assertTrue(false);
- }
- }
- }
- }
- }
- });
- }
-
- /** @deprecated using deprecated code */
- public void testCreateInstance() {
- for (int nodeType = 0; nodeType < 100; nodeType++) {
- Class nodeClass = null;
- try {
- nodeClass = ASTNode.nodeClassForType(nodeType);
- } catch (RuntimeException e) {
- // oops - guess that's not valid
- }
- if (nodeClass != null) {
- try {
- ASTNode node = ast.createInstance(nodeClass);
- if (ast.apiLevel() == AST.JLS2) {
- assertTrue((nodeType >= 1) && (nodeType <= 69));
- } else {
- assertTrue((nodeType >= 1) && (nodeType <= 83));
- }
- assertTrue(node.getNodeType() == nodeType);
- //ASTNode node2 = ast.createInstance(nodeType);
- //assertTrue(node2.getNodeType() == nodeType);
- } catch (RuntimeException e) {
- if (ast.apiLevel() == AST.JLS2) {
- assertTrue((nodeType < 1) || (nodeType > 69));
- } else {
- assertTrue((nodeType < 1) || (nodeType > 83));
- }
- }
- }
- }
- }
-
- public void testNodeClassForType() {
- Set classes = new HashSet(100);
- // make sure node types are contiguous starting at 0
- int hi = 0;
- for (int nodeType = 1; nodeType < 100; nodeType++) {
- try {
- Class nodeClass = ASTNode.nodeClassForType(nodeType);
- assertTrue(ASTNode.class.isAssignableFrom(nodeClass));
- classes.add(nodeClass);
- if (nodeType > 1) {
- assertTrue(hi == nodeType - 1);
- }
- hi = nodeType;
- } catch (RuntimeException e) {
- // oops - guess that's not valid
- }
- }
- assertTrue(hi == 83); // last known one
- assertTrue(classes.size() == hi); // all classes are distinct
- }
-}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTTest.java
deleted file mode 100644
index dfb9462..0000000
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTTest.java
+++ /dev/null
@@ -1,7191 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.wst.jsdt.core.tests.dom;
-
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import junit.framework.Test;
-
-import org.eclipse.wst.jsdt.core.dom.AST;
-import org.eclipse.wst.jsdt.core.dom.ASTMatcher;
-import org.eclipse.wst.jsdt.core.dom.ASTNode;
-import org.eclipse.wst.jsdt.core.dom.ASTVisitor;
-import org.eclipse.wst.jsdt.core.dom.AbstractTypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.AnonymousClassDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ArrayAccess;
-import org.eclipse.wst.jsdt.core.dom.ArrayCreation;
-import org.eclipse.wst.jsdt.core.dom.ArrayInitializer;
-import org.eclipse.wst.jsdt.core.dom.ArrayType;
-import org.eclipse.wst.jsdt.core.dom.Assignment;
-import org.eclipse.wst.jsdt.core.dom.Block;
-import org.eclipse.wst.jsdt.core.dom.BlockComment;
-import org.eclipse.wst.jsdt.core.dom.BodyDeclaration;
-import org.eclipse.wst.jsdt.core.dom.BooleanLiteral;
-import org.eclipse.wst.jsdt.core.dom.BreakStatement;
-import org.eclipse.wst.jsdt.core.dom.CatchClause;
-import org.eclipse.wst.jsdt.core.dom.CharacterLiteral;
-import org.eclipse.wst.jsdt.core.dom.ClassInstanceCreation;
-import org.eclipse.wst.jsdt.core.dom.Comment;
-import org.eclipse.wst.jsdt.core.dom.ConditionalExpression;
-import org.eclipse.wst.jsdt.core.dom.ConstructorInvocation;
-import org.eclipse.wst.jsdt.core.dom.ContinueStatement;
-import org.eclipse.wst.jsdt.core.dom.DoStatement;
-import org.eclipse.wst.jsdt.core.dom.EmptyStatement;
-import org.eclipse.wst.jsdt.core.dom.EnhancedForStatement;
-import org.eclipse.wst.jsdt.core.dom.Expression;
-import org.eclipse.wst.jsdt.core.dom.ExpressionStatement;
-import org.eclipse.wst.jsdt.core.dom.FieldAccess;
-import org.eclipse.wst.jsdt.core.dom.FieldDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ForStatement;
-import org.eclipse.wst.jsdt.core.dom.FunctionDeclaration;
-import org.eclipse.wst.jsdt.core.dom.FunctionInvocation;
-import org.eclipse.wst.jsdt.core.dom.FunctionRef;
-import org.eclipse.wst.jsdt.core.dom.FunctionRefParameter;
-import org.eclipse.wst.jsdt.core.dom.IfStatement;
-import org.eclipse.wst.jsdt.core.dom.ImportDeclaration;
-import org.eclipse.wst.jsdt.core.dom.InfixExpression;
-import org.eclipse.wst.jsdt.core.dom.Initializer;
-import org.eclipse.wst.jsdt.core.dom.InstanceofExpression;
-import org.eclipse.wst.jsdt.core.dom.JSdoc;
-import org.eclipse.wst.jsdt.core.dom.JavaScriptUnit;
-import org.eclipse.wst.jsdt.core.dom.LabeledStatement;
-import org.eclipse.wst.jsdt.core.dom.LineComment;
-import org.eclipse.wst.jsdt.core.dom.MemberRef;
-import org.eclipse.wst.jsdt.core.dom.Modifier;
-import org.eclipse.wst.jsdt.core.dom.Name;
-import org.eclipse.wst.jsdt.core.dom.NullLiteral;
-import org.eclipse.wst.jsdt.core.dom.NumberLiteral;
-import org.eclipse.wst.jsdt.core.dom.PackageDeclaration;
-import org.eclipse.wst.jsdt.core.dom.ParenthesizedExpression;
-import org.eclipse.wst.jsdt.core.dom.PostfixExpression;
-import org.eclipse.wst.jsdt.core.dom.PrefixExpression;
-import org.eclipse.wst.jsdt.core.dom.PrimitiveType;
-import org.eclipse.wst.jsdt.core.dom.QualifiedName;
-import org.eclipse.wst.jsdt.core.dom.QualifiedType;
-import org.eclipse.wst.jsdt.core.dom.ReturnStatement;
-import org.eclipse.wst.jsdt.core.dom.SimpleName;
-import org.eclipse.wst.jsdt.core.dom.SimpleType;
-import org.eclipse.wst.jsdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.wst.jsdt.core.dom.Statement;
-import org.eclipse.wst.jsdt.core.dom.StringLiteral;
-import org.eclipse.wst.jsdt.core.dom.SuperConstructorInvocation;
-import org.eclipse.wst.jsdt.core.dom.SuperFieldAccess;
-import org.eclipse.wst.jsdt.core.dom.SuperMethodInvocation;
-import org.eclipse.wst.jsdt.core.dom.SwitchCase;
-import org.eclipse.wst.jsdt.core.dom.SwitchStatement;
-import org.eclipse.wst.jsdt.core.dom.TagElement;
-import org.eclipse.wst.jsdt.core.dom.TextElement;
-import org.eclipse.wst.jsdt.core.dom.ThisExpression;
-import org.eclipse.wst.jsdt.core.dom.ThrowStatement;
-import org.eclipse.wst.jsdt.core.dom.TryStatement;
-import org.eclipse.wst.jsdt.core.dom.Type;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclaration;
-import org.eclipse.wst.jsdt.core.dom.TypeDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.TypeLiteral;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.wst.jsdt.core.dom.VariableDeclarationStatement;
-import org.eclipse.wst.jsdt.core.dom.WhileStatement;
-
-// testing
-
-public class ASTTest extends org.eclipse.wst.jsdt.core.tests.junit.extension.TestCase {
-
- class CheckPositionsMatcher extends ASTMatcher {
-
- public CheckPositionsMatcher() {
- // include doc tags
- super(true);
- }
-
- private void checkPositions(Object source, Object destination) {
- assertTrue(source instanceof ASTNode);
- assertTrue(destination instanceof ASTNode);
- int startPosition = ((ASTNode)source).getStartPosition();
- if (startPosition != -1) {
- assertTrue(startPosition == ((ASTNode)destination).getStartPosition());
- }
- int length = ((ASTNode)source).getLength();
- if (length != 0) {
- assertTrue(length == ((ASTNode)destination).getLength());
- }
- }
-
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(AnonymousClassDeclaration, Object)
- */
- public boolean match(AnonymousClassDeclaration node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ArrayAccess, Object)
- */
- public boolean match(ArrayAccess node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ArrayCreation, Object)
- */
- public boolean match(ArrayCreation node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ArrayInitializer, Object)
- */
- public boolean match(ArrayInitializer node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ArrayType, Object)
- */
- public boolean match(ArrayType node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(Assignment, Object)
- */
- public boolean match(Assignment node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(Block, Object)
- */
- public boolean match(Block node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(BlockComment, Object)
- * @since 3.0
- */
- public boolean match(BlockComment node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(BooleanLiteral, Object)
- */
- public boolean match(BooleanLiteral node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(BreakStatement, Object)
- */
- public boolean match(BreakStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(CatchClause, Object)
- */
- public boolean match(CatchClause node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(CharacterLiteral, Object)
- */
- public boolean match(CharacterLiteral node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ClassInstanceCreation, Object)
- */
- public boolean match(ClassInstanceCreation node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(JavaScriptUnit, Object)
- */
- public boolean match(JavaScriptUnit node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ConditionalExpression, Object)
- */
- public boolean match(ConditionalExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ConstructorInvocation, Object)
- */
- public boolean match(ConstructorInvocation node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ContinueStatement, Object)
- */
- public boolean match(ContinueStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(DoStatement, Object)
- */
- public boolean match(DoStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(EmptyStatement, Object)
- */
- public boolean match(EmptyStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(EnhancedForStatement, Object)
- * @since 3.0
- */
- public boolean match(EnhancedForStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ExpressionStatement, Object)
- */
- public boolean match(ExpressionStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(FieldAccess, Object)
- */
- public boolean match(FieldAccess node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(FieldDeclaration, Object)
- */
- public boolean match(FieldDeclaration node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ForStatement, Object)
- */
- public boolean match(ForStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(IfStatement, Object)
- */
- public boolean match(IfStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ImportDeclaration, Object)
- */
- public boolean match(ImportDeclaration node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(InfixExpression, Object)
- */
- public boolean match(InfixExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(Initializer, Object)
- */
- public boolean match(Initializer node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(InstanceofExpression, Object)
- */
- public boolean match(InstanceofExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(JSdoc, Object)
- */
- public boolean match(JSdoc node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(LabeledStatement, Object)
- */
- public boolean match(LabeledStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(LineComment, Object)
- * @since 3.0
- */
- public boolean match(LineComment node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(MemberRef, Object)
- * @since 3.0
- */
- public boolean match(MemberRef node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
-
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(FunctionDeclaration, Object)
- */
- public boolean match(FunctionDeclaration node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(FunctionInvocation, Object)
- */
- public boolean match(FunctionInvocation node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(FunctionRef, Object)
- * @since 3.0
- */
- public boolean match(FunctionRef node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(FunctionRefParameter, Object)
- * @since 3.0
- */
- public boolean match(FunctionRefParameter node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(Modifier, Object)
- * @since 3.0
- */
- public boolean match(Modifier node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(NullLiteral, Object)
- */
- public boolean match(NullLiteral node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(NumberLiteral, Object)
- */
- public boolean match(NumberLiteral node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(PackageDeclaration, Object)
- */
- public boolean match(PackageDeclaration node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ParenthesizedExpression, Object)
- */
- public boolean match(ParenthesizedExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(PostfixExpression, Object)
- */
- public boolean match(PostfixExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(PrefixExpression, Object)
- */
- public boolean match(PrefixExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(PrimitiveType, Object)
- */
- public boolean match(PrimitiveType node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(QualifiedName, Object)
- */
- public boolean match(QualifiedName node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(QualifiedType, Object)
- * @since 3.0
- */
- public boolean match(QualifiedType node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ReturnStatement, Object)
- */
- public boolean match(ReturnStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SimpleName, Object)
- */
- public boolean match(SimpleName node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SimpleType, Object)
- */
- public boolean match(SimpleType node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SingleVariableDeclaration, Object)
- */
- public boolean match(SingleVariableDeclaration node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(StringLiteral, Object)
- */
- public boolean match(StringLiteral node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SuperConstructorInvocation, Object)
- */
- public boolean match(SuperConstructorInvocation node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SuperFieldAccess, Object)
- */
- public boolean match(SuperFieldAccess node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SuperMethodInvocation, Object)
- */
- public boolean match(SuperMethodInvocation node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SwitchCase, Object)
- */
- public boolean match(SwitchCase node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(SwitchStatement, Object)
- */
- public boolean match(SwitchStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
-
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(TagElement, Object)
- * @since 3.0
- */
- public boolean match(TagElement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(TextElement, Object)
- * @since 3.0
- */
- public boolean match(TextElement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ThisExpression, Object)
- */
- public boolean match(ThisExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(ThrowStatement, Object)
- */
- public boolean match(ThrowStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(TryStatement, Object)
- */
- public boolean match(TryStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(TypeDeclaration, Object)
- */
- public boolean match(TypeDeclaration node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(TypeDeclarationStatement, Object)
- */
- public boolean match(TypeDeclarationStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(TypeLiteral, Object)
- */
- public boolean match(TypeLiteral node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(VariableDeclarationExpression, Object)
- */
- public boolean match(VariableDeclarationExpression node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(VariableDeclarationFragment, Object)
- */
- public boolean match(VariableDeclarationFragment node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(VariableDeclarationStatement, Object)
- */
- public boolean match(VariableDeclarationStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
-
- /**
- * @see org.eclipse.wst.jsdt.core.dom.ASTMatcher#match(WhileStatement, Object)
- */
- public boolean match(WhileStatement node, Object other) {
- checkPositions(node, other);
- return super.match(node, other);
- }
- }
-
- /** @deprecated using deprecated code */
- public static Test suite() {
- // TODO (frederic) use buildList + setAstLevel(init) instead...
- junit.framework.TestSuite suite = new junit.framework.TestSuite(ASTTest.class.getName());
-
- Class c = ASTTest.class;
- Method[] methods = c.getMethods();
- for (int i = 0, max = methods.length; i < max; i++) {
- if (methods[i].getName().startsWith("test")) { //$NON-NLS-1$
- suite.addTest(new ASTTest(methods[i].getName(), AST.JLS2));
- //suite.addTest(new ASTTest(methods[i].getName(), AST.JLS3));
- }
- }
- return suite;
- }
-
- AST ast;
- int API_LEVEL;
-
-
- public ASTTest(String name, int apiLevel) {
- super(name);
- this.API_LEVEL = apiLevel;
- }
-
- protected void setUp() throws Exception {
- super.setUp();
- ast = AST.newAST(this.API_LEVEL);
- }
-
- protected void tearDown() throws Exception {
- ast = null;
- super.tearDown();
- }
-
- /** @deprecated using deprecated code */
- public String getName() {
- String name = super.getName();
- switch (this.API_LEVEL) {
- case AST.JLS2:
- name = "JLS2 - " + name;
- break;
- case AST.JLS3:
- name = "JLS3 - " + name;
- break;
- }
- return name;
- }
-
- /**
- * Snippets that show how to...
- * @deprecated using deprecated code
- */
- public void testExampleSnippets() {
- {
- AST localAst = AST.newAST(ast.apiLevel());
- JavaScriptUnit cu = localAst.newJavaScriptUnit();
-
- // package com.example;
- PackageDeclaration pd = localAst.newPackageDeclaration();
- pd.setName(localAst.newName(new String[]{"com", "example"})); //$NON-NLS-1$ //$NON-NLS-2$
- cu.setPackage(pd);
- assertTrue(pd.getRoot() == cu);
-
- // import java.io;*;
- ImportDeclaration im1 = localAst.newImportDeclaration();
- im1.setName(localAst.newName(new String[]{"java", "io"})); //$NON-NLS-1$ //$NON-NLS-2$
- im1.setOnDemand(true);
- cu.imports().add(im1);
- assertTrue(im1.getRoot() == cu);
-
- // import java.util.List;
- ImportDeclaration im2 = localAst.newImportDeclaration();
- im2.setName(localAst.newName(new String[]{"java", "util", "List"})); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- im2.setOnDemand(false);
- cu.imports().add(im2);
- assertTrue(im2.getRoot() == cu);
-
- // /** Spec. \n @deprecated Use {@link #foo() bar} instead. */public class MyClass {}
- TypeDeclaration td = localAst.newTypeDeclaration();
- if (ast.apiLevel() == AST.JLS2) {
- td.setModifiers(Modifier.PUBLIC);
- } else {
- td.modifiers().add(localAst.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
- }
- td.setName(localAst.newSimpleName("MyClass")); //$NON-NLS-1$
- {
- JSdoc jd = localAst.newJSdoc();
- TagElement tg0 = localAst.newTagElement();
- jd.tags().add(tg0);
- TextElement tx1 = localAst.newTextElement();
- tx1.setText("Spec."); //$NON-NLS-1$
- tg0.fragments().add(tx1);
- TagElement tg1 = localAst.newTagElement();
- tg1.setTagName(TagElement.TAG_DEPRECATED);
- jd.tags().add(tg1);
- TextElement tx2 = localAst.newTextElement();
- tx2.setText("Use "); //$NON-NLS-1$
- tg1.fragments().add(tx2);
- TagElement tg2 = localAst.newTagElement();
- tg2.setTagName(TagElement.TAG_LINK);
- tg1.fragments().add(tg2);
- FunctionRef mr1 = localAst.newFunctionRef();
- mr1.setName(localAst.newSimpleName("foo"));
- tg2.fragments().add(mr1);
- TextElement tx3 = localAst.newTextElement();
- tx3.setText("bar"); //$NON-NLS-1$
- tg2.fragments().add(tx3);
- TextElement tx4 = localAst.newTextElement();
- tx2.setText(" instead."); //$NON-NLS-1$
- tg1.fragments().add(tx4);
- }
-
- cu.types().add(td);
- assertTrue(td.getRoot() == cu);
-
- // private static boolean DEBUG = true;
- VariableDeclarationFragment f1 = localAst.newVariableDeclarationFragment();
- f1.setName(localAst.newSimpleName("DEBUG")); //$NON-NLS-1$
- f1.setInitializer(localAst.newBooleanLiteral(true));
- FieldDeclaration fd = localAst.newFieldDeclaration(f1);
- fd.setType(localAst.newPrimitiveType(PrimitiveType.BOOLEAN));
- if (ast.apiLevel() == AST.JLS2) {
- fd.setModifiers(Modifier.PRIVATE | Modifier.FINAL);
- } else {
- fd.modifiers().add(localAst.newModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD));
- fd.modifiers().add(localAst.newModifier(Modifier.ModifierKeyword.STATIC_KEYWORD));
- }
- td.bodyDeclarations().add(fd);
- assertTrue(fd.getRoot() == cu);
-
- // public static void main();
- FunctionDeclaration md = localAst.newFunctionDeclaration();
- if (ast.apiLevel() == AST.JLS2) {
- md.setModifiers(Modifier.PUBLIC | Modifier.STATIC);
- md.setReturnType(localAst.newPrimitiveType(PrimitiveType.VOID));
- } else {
- md.modifiers().add(localAst.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
- md.modifiers().add(localAst.newModifier(Modifier.ModifierKeyword.STATIC_KEYWORD));
- md.setReturnType2(localAst.newPrimitiveType(PrimitiveType.VOID));
- }
- md.setConstructor(false);
- md.setName(localAst.newSimpleName("main")); //$NON-NLS-1$
- td.bodyDeclarations().add(md);
- assertTrue(md.getRoot() == cu);
-
- // String[] args
- SingleVariableDeclaration a1 = localAst.newSingleVariableDeclaration();
- a1.setType(localAst.newArrayType(
- localAst.newSimpleType(localAst.newSimpleName("String")))); //$NON-NLS-1$
- a1.setName(localAst.newSimpleName("args")); //$NON-NLS-1$
- md.parameters().add(a1);
- assertTrue(a1.getRoot() == cu);
-
- // {}
- Block b = localAst.newBlock();
- md.setBody(b);
- assertTrue(b.getRoot() == cu);
-
- // System.out.println("hello world");
- FunctionInvocation e = localAst.newFunctionInvocation();
- e.setExpression(localAst.newName(new String[] {"System", "out"})); //$NON-NLS-1$ //$NON-NLS-2$
- e.setName(localAst.newSimpleName("println")); //$NON-NLS-1$
- StringLiteral h = localAst.newStringLiteral();
- h.setLiteralValue("hello world"); //$NON-NLS-1$
- e.arguments().add(h);
-
- b.statements().add(localAst.newExpressionStatement(e));
- assertTrue(e.getRoot() == cu);
- assertTrue(h.getRoot() == cu);
-
- // new String[len];
- ArrayCreation ac1 = localAst.newArrayCreation();
- ac1.setType(
- localAst.newArrayType(
- localAst.newSimpleType(localAst.newSimpleName("String")))); //$NON-NLS-1$
- ac1.dimensions().add(localAst.newSimpleName("len")); //$NON-NLS-1$
- b.statements().add(localAst.newExpressionStatement(ac1));
- assertTrue(ac1.getRoot() == cu);
-
- // new double[7][24][];
- ArrayCreation ac2 = localAst.newArrayCreation();
- ac2.setType(
- localAst.newArrayType(
- localAst.newPrimitiveType(PrimitiveType.DOUBLE), 3));
- ac2.dimensions().add(localAst.newNumberLiteral("7")); //$NON-NLS-1$
- ac2.dimensions().add(localAst.newNumberLiteral("24")); //$NON-NLS-1$
- b.statements().add(localAst.newExpressionStatement(ac2));
- assertTrue(ac2.getRoot() == cu);
-
- // new int[] {1, 2};
- ArrayCreation ac3 = localAst.newArrayCreation();
- ac3.setType(
- localAst.newArrayType(
- localAst.newPrimitiveType(PrimitiveType.INT)));
- ArrayInitializer ai = localAst.newArrayInitializer();
- ac3.setInitializer(ai);
- ai.expressions().add(localAst.newNumberLiteral("1")); //$NON-NLS-1$
- ai.expressions().add(localAst.newNumberLiteral("2")); //$NON-NLS-1$
- b.statements().add(localAst.newExpressionStatement(ac3));
- assertTrue(ac3.getRoot() == cu);
- assertTrue(ai.getRoot() == cu);
-
- // new String(10);
- ClassInstanceCreation cr1 = localAst.newClassInstanceCreation();
- if (ast.apiLevel() == AST.JLS2) {
- cr1.setName(localAst.newSimpleName("String")); //$NON-NLS-1$
- } else {
- cr1.setType(localAst.newSimpleType(localAst.newSimpleName("String"))); //$NON-NLS-1$
- }
- cr1.arguments().add(localAst.newNumberLiteral("10")); //$NON-NLS-1$
- b.statements().add(localAst.newExpressionStatement(cr1));
- assertTrue(cr1.getRoot() == cu);
-
- // new Listener() {public void handleEvent() {} };
- ClassInstanceCreation cr2 = localAst.newClassInstanceCreation();
- AnonymousClassDeclaration ad1 = localAst.newAnonymousClassDeclaration();
- cr2.setAnonymousClassDeclaration(ad1);
- if (ast.apiLevel() == AST.JLS2) {
- cr2.setName(localAst.newSimpleName("Listener")); //$NON-NLS-1$
- } else {
- cr2.setType(localAst.newSimpleType(localAst.newSimpleName("Listener"))); //$NON-NLS-1$
- }
- FunctionDeclaration md0 = localAst.newFunctionDeclaration();
- if (ast.apiLevel() == AST.JLS2) {
- md0.setModifiers(Modifier.PUBLIC);
- } else {
- md0.modifiers().add(localAst.newModifier(Modifier.ModifierKeyword.PUBLIC_KEYWORD));
- }
- md0.setName(localAst.newSimpleName("handleEvent")); //$NON-NLS-1$
- md0.setBody(localAst.newBlock());
- ad1.bodyDeclarations().add(md0);
- b.statements().add(localAst.newExpressionStatement(cr2));
- assertTrue(cr2.getRoot() == cu);
- assertTrue(md0.getRoot() == cu);
- assertTrue(ad1.getRoot() == cu);
-
- }
- }
-
- abstract class Property {
-
- /**
- * Indicates whether this property is compulsory, in that every node
- * must have a value at all times.
- */
- private boolean compulsory;
-
- private Class nodeType;
- private String propertyName;
-
- /**
- * Creates a new property with the given name.
- */
- Property(String propertyName, boolean compulsory, Class nodeType) {
- this.propertyName = propertyName;
- this.compulsory = compulsory;
- this.nodeType = nodeType;
- }
-
- /**
- * Returns a sample node of a type suitable for storing
- * in this property.
- *
- * @param targetAST the target AST
- * @param parented <code>true</code> if the sample should be
- * parented, and <code>false</code> if unparented
- * @return a sample node
- */
- public abstract ASTNode sample(AST targetAST, boolean parented);
-
- /**
- * Returns examples of node of types unsuitable for storing
- * in this property.
- * <p>
- * This implementation returns an empty list. Subclasses
- * should reimplement to specify counter-examples.
- * </p>
- *
- * @param targetAST the target AST
- * @return a list of counter-example nodes
- */
- public ASTNode[] counterExamples(AST targetAST) {
- return new ASTNode[] {};
- }
-
- /**
- * Returns a sample node of a type suitable for storing
- * in this property. The sample embeds the node itself.
- * <p>
- * For instance, for an Expression-valued property of a given
- * Statement, this method returns an Expression that embeds
- * this Statement node (as a descendent).
- * </p>
- * <p>
- * Returns <code>null</code> if such an embedding is impossible.
- * For instance, for an Name-valued property of a given
- * Statement, this method returns <code>null</code> because
- * an Expression cannot be embedded in a Name.
- * </p>
- * <p>
- * This implementation returns <code>null</code>. Subclasses
- * should reimplement to specify an embedding.
- * </p>
- *
- * @return a sample node that embeds the given node,
- * and <code>null</code> if such an embedding is impossible
- */
- public ASTNode wrap() {
- return null;
- }
-
- /**
- * Undoes the effects of a previous <code>wrap</code>.
- * <p>
- * This implementation does nothing. Subclasses
- * should reimplement if they reimplement <code>wrap</code>.
- * </p>
- */
- public void unwrap() {
- }
-
- /**
- * Returns whether this property is compulsory, in that every node
- * must have a value at all times.
- *
- * @return <code>true</code> if the property is compulsory,
- * and <code>false</code> if the property may be null
- */
- public final boolean isCompulsory() {
- return compulsory;
- }
-
- /**
- * Returns the value of this property.
- * <p>
- * This implementation throws an unchecked exception. Subclasses
- * should reimplement.
- * </p>
- *
- * @return the property value, or <code>null</code> if no value
- */
- public ASTNode get() {
- throw new RuntimeException("get not implemented"); //$NON-NLS-1$
- }
-
- /**
- * Sets or clears the value of this property.
- * <p>
- * This implementation throws an unchecked exception. Subclasses
- * should reimplement.
- * </p>
- *
- * @param value the property value, or <code>null</code> if no value
- */
- public void set(ASTNode value) {
- throw new RuntimeException("get(" + value + ") not implemented"); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- public String toString() {
- return "Property(" + this.propertyName + ", " + this.compulsory + ", " + this.nodeType + ")"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- }
- }
-
- /**
- * Exercises the given property of the given node.
- *
- * @param node the node to test
- * @param prop the property descriptor
- */
- void genericPropertyTest(ASTNode node, Property prop) {
-
- ASTNode x1 = prop.sample(node.getAST(), false);
- prop.set(x1);
- assertTrue(prop.get() == x1);
- assertTrue(x1.getParent() == node);
-
- // check handling of null
- if (prop.isCompulsory()) {
- try {
- prop.set(null);
- } catch (RuntimeException e) {
- // pass
- }
- } else {
- long previousCount = node.getAST().modificationCount();
- prop.set(null);
- assertTrue(prop.get() == null);
- assertTrue(node.getAST().modificationCount() > previousCount);
- }
-
- // check that a child from a different AST is detected
- try {
- AST newAST = AST.newAST(node.getAST().apiLevel());
- prop.set(prop.sample(newAST, false));
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check that a child with a parent is detected
- try {
- ASTNode b1 = prop.sample(node.getAST(), true);
- prop.set(b1); // bogus: already has parent
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check that a cycle is detected
- assertTrue(node.getParent() == null);
- ASTNode s1 = null;
- try {
- s1 = prop.wrap();
- if (s1 != null) {
- prop.set(s1); // bogus: creates a cycle
- assertTrue(false);
- }
- } catch (RuntimeException e) {
- // pass
- } finally {
- if (s1 != null) {
- prop.unwrap();
- assertTrue(node.getParent() == null);
- }
- }
-
- // check that a child of the wrong type is detected
- ASTNode b1[] = prop.counterExamples(node.getAST());
- for (int i = 0; i < b1.length; i++) {
- try {
- prop.set(b1[i]); // bogus: wrong type
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
- }
-
- }
-
- /**
- * Exercises the given property of the given node.
- *
- * @param node the node to test
- * @param children the node to test
- * @param prop the property descriptor
- */
- void genericPropertyListTest(ASTNode node, List children, Property prop) {
-
- // wipe the slate clean
- children.clear();
- assertTrue(children.size() == 0);
-
- // add a child
- ASTNode x1 = prop.sample(node.getAST(), false);
- long previousCount = node.getAST().modificationCount();
- children.add(x1);
- assertTrue(node.getAST().modificationCount() > previousCount);
- assertTrue(children.size() == 1);
- assertTrue(children.get(0) == x1);
- assertTrue(x1.getParent() == node);
-
- // add a second child
- ASTNode x2 = prop.sample(node.getAST(), false);
- previousCount = node.getAST().modificationCount();
- children.add(x2);
- assertTrue(node.getAST().modificationCount() > previousCount);
- assertTrue(children.size() == 2);
- assertTrue(children.get(0) == x1);
- assertTrue(children.get(1) == x2);
- assertTrue(x1.getParent() == node);
- assertTrue(x2.getParent() == node);
-
- // remove the first child
- previousCount = node.getAST().modificationCount();
- children.remove(0);
- assertTrue(node.getAST().modificationCount() > previousCount);
- assertTrue(children.size() == 1);
- assertTrue(children.get(0) == x2);
- assertTrue(x1.getParent() == null);
- assertTrue(x2.getParent() == node);
-
- // remove the remaining child
- previousCount = node.getAST().modificationCount();
- children.remove(x2);
- assertTrue(node.getAST().modificationCount() > previousCount);
- assertTrue(children.size() == 0);
- assertTrue(x1.getParent() == null);
- assertTrue(x2.getParent() == null);
-
- // check that null is never allowed
- try {
- children.add(null);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check that a child from a different AST is detected
- try {
- AST newAST = AST.newAST(node.getAST().apiLevel());
- children.add(prop.sample(newAST, false));
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check that a child with a parent is detected
- try {
- ASTNode b1 = prop.sample(node.getAST(), true);
- children.add(b1); // bogus: already has parent
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check that a cycle is detected
- assertTrue(node.getParent() == null);
- ASTNode s1 = null;
- try {
- s1 = prop.wrap();
- if (s1 != null) {
- children.add(s1); // bogus: creates a cycle
- assertTrue(false);
- }
- } catch (RuntimeException e) {
- // pass
- } finally {
- if (s1 != null) {
- prop.unwrap();
- assertTrue(node.getParent() == null);
- }
- }
-
- // check that a child of the wrong type is detected
- ASTNode b1[] = prop.counterExamples(node.getAST());
- for (int i = 0; i < b1.length; i++) {
- try {
- children.add(b1[i]); // bogus: wrong type
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
- }
-
- }
-
- /** @deprecated using deprecated code */
- public void testAST() {
-
- assertTrue(AST.JLS2 == 2);
- assertTrue(AST.JLS3 == 3);
-
- AST a0 = new AST(); // deprecated, but still 2.0
- assertTrue(a0.apiLevel() == AST.JLS2);
- AST a1 = new AST(new HashMap()); // deprecated, but still 2.0
- assertTrue(a1.apiLevel() == AST.JLS2);
- AST a2 = AST.newAST(AST.JLS2);
- assertTrue(a2.apiLevel() == AST.JLS2);
- AST a3 = AST.newAST(AST.JLS3);
- assertTrue(a3.apiLevel() == AST.JLS3);
-
-
- // modification count is always non-negative
- assertTrue(ast.modificationCount() >= 0);
-
- // modification count increases for node creations
- long previousCount = ast.modificationCount();
- SimpleName x = ast.newSimpleName("first"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
-
- // modification count does not increase for reading node attributes
- previousCount = ast.modificationCount();
- x.getIdentifier();
- x.getParent();
- x.getRoot();
- x.getAST();
- x.getFlags();
- x.getStartPosition();
- x.getLength();
- x.equals(x);
- assertTrue(ast.modificationCount() == previousCount);
-
- // modification count does not increase for reading or writing properties
- previousCount = ast.modificationCount();
- x.getProperty("any"); //$NON-NLS-1$
- x.setProperty("any", "value"); // N.B. //$NON-NLS-1$ //$NON-NLS-2$
- x.properties();
- assertTrue(ast.modificationCount() == previousCount);
-
- // modification count increases for changing node attributes
- previousCount = ast.modificationCount();
- x.setIdentifier("second"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
-
- previousCount = ast.modificationCount();
- x.setFlags(0);
- assertTrue(ast.modificationCount() > previousCount);
-
- previousCount = ast.modificationCount();
- x.setSourceRange(-1,0);
- assertTrue(ast.modificationCount() > previousCount);
- }
-
- public void testWellKnownBindings() {
-
- // well known bindings
- String[] wkbs = {
- "byte", "char", "short", "int", "long", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "boolean", "float", "double", "void", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "java.lang.Class", //$NON-NLS-1$
- "java.lang.Cloneable", //$NON-NLS-1$
- "java.lang.Error", //$NON-NLS-1$
- "java.lang.Exception", //$NON-NLS-1$
- "java.lang.Object", //$NON-NLS-1$
- "java.lang.RuntimeException", //$NON-NLS-1$
- "java.lang.String", //$NON-NLS-1$
- "java.lang.StringBuffer", //$NON-NLS-1$
- "java.lang.Throwable", //$NON-NLS-1$
- "java.io.Serializable", //$NON-NLS-1$
- "java.lang.Boolean", //$NON-NLS-1$
- "java.lang.Byte", //$NON-NLS-1$
- "java.lang.Character", //$NON-NLS-1$
- "java.lang.Double", //$NON-NLS-1$
- "java.lang.Float", //$NON-NLS-1$
- "java.lang.Integer", //$NON-NLS-1$
- "java.lang.Long", //$NON-NLS-1$
- "java.lang.Short", //$NON-NLS-1$
- "java.lang.Void", //$NON-NLS-1$
- };
-
- // no-so-well-known bindings
- String[] nwkbs = {
- "verylong", //$NON-NLS-1$
- "java.lang.Math", //$NON-NLS-1$
- "com.example.MyCode", //$NON-NLS-1$
- };
-
- // none of the well known bindings resolve in a plain AST
- for (int i = 0; i<wkbs.length; i++) {
- assertTrue(ast.resolveWellKnownType(wkbs[i]) == null);
- }
-
- // none of the no so well known bindings resolve either
- for (int i = 0; i<nwkbs.length; i++) {
- assertTrue(ast.resolveWellKnownType(nwkbs[i]) == null);
- }
- }
-
- public void testSimpleName() {
- long previousCount = ast.modificationCount();
- SimpleName x = ast.newSimpleName("foo"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue("foo".equals(x.getIdentifier())); //$NON-NLS-1$
- assertTrue("foo".equals(x.getFullyQualifiedName())); //$NON-NLS-1$
- assertTrue(x.getNodeType() == ASTNode.SIMPLE_NAME);
- assertTrue(x.isDeclaration() == false);
- assertTrue(x.structuralPropertiesForType() == SimpleName.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
- x.setIdentifier("bar"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue("bar".equals(x.getIdentifier())); //$NON-NLS-1$
- assertTrue("bar".equals(x.getFullyQualifiedName())); //$NON-NLS-1$
-
- // check that property cannot be set to null
- try {
- x.setIdentifier(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check that property cannot be set to keyword or reserved work
- String[] reserved =
- new String[] {
- "true", "false", "null", // literals //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "abstract", "default", "if", "private", "this", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "boolean", "do", "implements", "protected", "throw", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "break", "double", "import", "public", "throws", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "byte", "else", "instanceof", "return", "transient", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "case", "extends", "int", "short", "try", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "catch", "final", "interface", "static", "void", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "char", "finally", "long", "strictfp", "volatile", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "class", "float", "native", "super", "while", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
- "const", "for", "new", "switch", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- "continue", "goto", "package", "synchronized"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
- for (int i=0; i<reserved.length; i++) {
- try {
- x.setIdentifier(reserved[i]);
- } catch (RuntimeException e) {
- // pass
- }
- }
-
- // check that property cannot be set to keyword or reserved work
- String[] bogus =
- new String[] {
- "a b", "a ", " a", // literals //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "a-b", "a[]", "a<T>", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "", " ", "a.b"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- for (int i=0; i<bogus.length; i++) {
- try {
- x.setIdentifier(bogus[i]);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
- }
- // check that "assert" is not considered a keyword
- // "assert" only became a keyword in J2SE 1.4 and we do *not* want to
- // preclude the AST API from being used to analyze pre-1.4 code
- x.setIdentifier("assert"); //$NON-NLS-1$
-
- // check that "enum" is not considered a keyword
- // "enum" only became a keyword in J2SE 1.5 and we do *not* want to
- // preclude the AST API from being used to analyze pre-1.5 code
- x.setIdentifier("enum"); //$NON-NLS-1$
-
- // check that isDeclaration works
- QualifiedName y = ast.newQualifiedName(ast.newSimpleName("a"), x); //$NON-NLS-1$
- assertTrue(x.isDeclaration() == false);
- y.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- assertTrue(x.isDeclaration() == false);
-
- TypeDeclaration td = ast.newTypeDeclaration();
- td.setName(x);
- assertTrue(x.isDeclaration() == true);
- td.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- assertTrue(x.isDeclaration() == false);
-
- FunctionDeclaration md = ast.newFunctionDeclaration();
- md.setName(x);
- assertTrue(x.isDeclaration() == true);
- md.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- assertTrue(x.isDeclaration() == false);
-
- SingleVariableDeclaration vd = ast.newSingleVariableDeclaration();
- vd.setName(x);
- assertTrue(x.isDeclaration() == true);
- vd.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- assertTrue(x.isDeclaration() == false);
-
- VariableDeclarationFragment fd = ast.newVariableDeclarationFragment();
- fd.setName(x);
- assertTrue(x.isDeclaration() == true);
- fd.setName(ast.newSimpleName("b")); //$NON-NLS-1$
- assertTrue(x.isDeclaration() == false);
-
-
- }
-
- public void testQualifiedName() {
- long previousCount = ast.modificationCount();
- final QualifiedName x = ast.newQualifiedName(
- ast.newSimpleName("q"), //$NON-NLS-1$
- ast.newSimpleName("i")); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getQualifier().getParent() == x);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getName().isDeclaration() == false);
- assertTrue(x.getNodeType() == ASTNode.QUALIFIED_NAME);
- assertTrue("q.i".equals(x.getFullyQualifiedName())); //$NON-NLS-1$
- assertTrue(x.structuralPropertiesForType() == QualifiedName.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Qualifier", true, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- QualifiedName result = targetAst.newQualifiedName(
- targetAst.newSimpleName("a"), //$NON-NLS-1$
- targetAst.newSimpleName("b")); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- QualifiedName s1 = ast.newQualifiedName(x, ast.newSimpleName("z")); //$NON-NLS-1$
- return s1;
- }
- public void unwrap() {
- QualifiedName s1 = (QualifiedName) x.getParent();
- s1.setQualifier(ast.newSimpleName("z")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getQualifier();
- }
- public void set(ASTNode value) {
- x.setQualifier((Name) value);
- }
- });
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
-
- // test fullyQualifiedName on nested names
- Name q0 = ast.newName(new String[] {"a", "bb", "ccc", "dddd", "eeeee", "ffffff"});
- assertTrue("a.bb.ccc.dddd.eeeee.ffffff".equals(q0.getFullyQualifiedName())); //$NON-NLS-1$
-
- }
-
- public void testNameFactories() {
- long previousCount = ast.modificationCount();
- Name x = ast.newName("foo"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue("foo".equals(x.getFullyQualifiedName())); //$NON-NLS-1$
- assertTrue(x.getNodeType() == ASTNode.SIMPLE_NAME);
-
- previousCount = ast.modificationCount();
- x = ast.newName("foo.bar"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue("foo.bar".equals(x.getFullyQualifiedName())); //$NON-NLS-1$
- assertTrue(x.getNodeType() == ASTNode.QUALIFIED_NAME);
- QualifiedName q = (QualifiedName) x;
- assertTrue("bar".equals(q.getName().getFullyQualifiedName())); //$NON-NLS-1$
- assertTrue("foo".equals(q.getQualifier().getFullyQualifiedName())); //$NON-NLS-1$
-
- // check that simple and qualified names work
- String[] legal =
- new String[] {
- "a", "abcdef", "XYZZY", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "a.b", "java.lang.Object", "a.b.c.d.e"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- for (int i=0; i<legal.length; i++) {
- try {
- x = ast.newName(legal[i]);
- assertTrue(legal[i].equals(x.getFullyQualifiedName()));
- } catch (RuntimeException e) {
- assertTrue(false);
- }
- }
-
- // check that property cannot be set to keyword or reserved work
- String[] bogus =
- new String[] {
- "", ".", ".a", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "a.", "a..b", "..a"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- for (int i=0; i<bogus.length; i++) {
- try {
- x = ast.newName(bogus[i]);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
- }
- }
-
- public void testNullLiteral() {
- long previousCount = ast.modificationCount();
- NullLiteral x = ast.newNullLiteral();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getNodeType() == ASTNode.NULL_LITERAL);
- assertTrue(x.structuralPropertiesForType() == NullLiteral.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- }
-
- public void testBooleanLiteral() {
- long previousCount = ast.modificationCount();
- BooleanLiteral x = ast.newBooleanLiteral(true);
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.booleanValue() == true);
- assertTrue(x.getNodeType() == ASTNode.BOOLEAN_LITERAL);
- assertTrue(x.structuralPropertiesForType() == BooleanLiteral.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
- x.setBooleanValue(false);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.booleanValue() == false);
-
- previousCount = ast.modificationCount();
- x.setBooleanValue(true);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.booleanValue() == true);
- }
-
- public void testStringLiteral() {
- long previousCount = ast.modificationCount();
- // check 0-arg factory first
- StringLiteral x = ast.newStringLiteral();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue("\"\"".equals(x.getEscapedValue())); //$NON-NLS-1$
- assertTrue("".equals(x.getLiteralValue())); //$NON-NLS-1$
- assertTrue(x.getNodeType() == ASTNode.STRING_LITERAL);
- assertTrue(x.structuralPropertiesForType() == StringLiteral.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
- x.setEscapedValue("\"bye\""); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue("\"bye\"".equals(x.getEscapedValue())); //$NON-NLS-1$
- assertTrue("bye".equals(x.getLiteralValue())); //$NON-NLS-1$
-
- previousCount = ast.modificationCount();
- x.setLiteralValue("hi"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue("\"hi\"".equals(x.getEscapedValue())); //$NON-NLS-1$
- assertTrue("hi".equals(x.getLiteralValue())); //$NON-NLS-1$
-
- previousCount = ast.modificationCount();
- x.setLiteralValue("\\012\\015"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertEquals("different", "\"\\\\012\\\\015\"", x.getEscapedValue()); //$NON-NLS-1$
- assertTrue("\\012\\015".equals(x.getLiteralValue())); //$NON-NLS-1$
-
- previousCount = ast.modificationCount();
- x.setLiteralValue("\012\015"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue("\n\r".equals(x.getLiteralValue())); //$NON-NLS-1$
- assertEquals("different", "\"\\n\\r\"", x.getEscapedValue()); //$NON-NLS-1$
-
- // check that property cannot be set to null
- try {
- x.setEscapedValue(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check that property cannot be set to null
- try {
- x.setLiteralValue(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
- }
-
- public void testStringLiteralUnicode() {
- AST localAst = AST.newAST(ast.apiLevel());
- StringLiteral literal = localAst.newStringLiteral();
- literal.setEscapedValue("\"hello\\u0026\\u0050worl\\u0064\""); //$NON-NLS-1$
- assertTrue(literal.getLiteralValue().equals("hello&Pworld")); //$NON-NLS-1$
-
- localAst = AST.newAST(ast.apiLevel());
- literal = localAst.newStringLiteral();
- literal.setEscapedValue("\"hello\\nworld\""); //$NON-NLS-1$
- assertTrue(literal.getLiteralValue().equals("hello\nworld")); //$NON-NLS-1$
-
- localAst = AST.newAST(ast.apiLevel());
- literal = localAst.newStringLiteral();
- literal.setLiteralValue("hello\nworld"); //$NON-NLS-1$
- assertTrue(literal.getLiteralValue().equals("hello\nworld")); //$NON-NLS-1$
-
- localAst = AST.newAST(ast.apiLevel());
- literal = localAst.newStringLiteral();
- literal.setLiteralValue("\n"); //$NON-NLS-1$
- assertTrue(literal.getEscapedValue().equals("\"\\n\"")); //$NON-NLS-1$
- assertTrue(literal.getLiteralValue().equals("\n")); //$NON-NLS-1$
-
- localAst = AST.newAST(ast.apiLevel());
- literal = localAst.newStringLiteral();
- literal.setEscapedValue("\"hello\\\"world\""); //$NON-NLS-1$
- assertTrue(literal.getLiteralValue().equals("hello\"world")); //$NON-NLS-1$
-
- localAst = AST.newAST(ast.apiLevel());
- literal = localAst.newStringLiteral();
- literal.setLiteralValue("hello\\u0026world"); //$NON-NLS-1$
- assertTrue(literal.getLiteralValue().equals("hello\\u0026world")); //$NON-NLS-1$
-
- localAst = AST.newAST(ast.apiLevel());
- literal = localAst.newStringLiteral();
- literal.setLiteralValue("hello\\u0026world"); //$NON-NLS-1$
- assertTrue(literal.getEscapedValue().equals("\"hello\\\\u0026world\"")); //$NON-NLS-1$
-
- localAst = AST.newAST(ast.apiLevel());
- literal = localAst.newStringLiteral();
- literal.setLiteralValue("\\u0001"); //$NON-NLS-1$
- assertTrue(literal.getEscapedValue().equals("\"\\\\u0001\"")); //$NON-NLS-1$
- }
-
- public void testCharacterLiteral() {
- long previousCount = ast.modificationCount();
- CharacterLiteral x = ast.newCharacterLiteral();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getEscapedValue().startsWith("\'")); //$NON-NLS-1$
- assertTrue(x.getEscapedValue().endsWith("\'")); //$NON-NLS-1$
- assertTrue(x.getNodeType() == ASTNode.CHARACTER_LITERAL);
- assertTrue(x.structuralPropertiesForType() == CharacterLiteral.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
- x.setEscapedValue("\'z\'"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue("\'z\'".equals(x.getEscapedValue())); //$NON-NLS-1$
- assertTrue(x.charValue() == 'z');
-
- // test other factory method
- previousCount = ast.modificationCount();
- CharacterLiteral y = ast.newCharacterLiteral();
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(y.getAST() == ast);
- assertTrue(y.getParent() == null);
- String v = y.getEscapedValue();
- assertTrue(v.length() >= 3 && v.charAt(0) == '\'' & v.charAt(v.length()-1 ) == '\'');
-
- // check that property cannot be set to null
- try {
- x.setEscapedValue(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // test escaped characters
- // b, t, n, f, r, ", ', \, 0, 1, 2, 3, 4, 5, 6, or 7
- try {
- x.setEscapedValue("\'\\b\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\t\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\n\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\f\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\\"\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\'\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\\\\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\0\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\1\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\2\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\3\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\4\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\5\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\6\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\7\'"); //$NON-NLS-1$
- x.setEscapedValue("\'\\u0041\'"); //$NON-NLS-1$
- assertTrue(x.charValue() == 'A');
- } catch(IllegalArgumentException e) {
- assertTrue(false);
- }
-
- x.setCharValue('\u0041');
- assertTrue(x.getEscapedValue().equals("\'A\'")); //$NON-NLS-1$
- x.setCharValue('\t');
- assertTrue(x.getEscapedValue().equals("\'\\t\'")); //$NON-NLS-1$
- x.setEscapedValue("\'\\\\\'"); //$NON-NLS-1$
- assertTrue(x.getEscapedValue().equals("\'\\\\\'")); //$NON-NLS-1$
- assertTrue(x.charValue() == '\\');
- x.setEscapedValue("\'\\\'\'"); //$NON-NLS-1$
- assertTrue(x.getEscapedValue().equals("\'\\\'\'")); //$NON-NLS-1$
- assertTrue(x.charValue() == '\'');
- x.setCharValue('\'');
- assertTrue(x.getEscapedValue().equals("\'\\\'\'")); //$NON-NLS-1$
- assertTrue(x.charValue() == '\'');
- x.setCharValue('\\');
- assertTrue(x.getEscapedValue().equals("\'\\\\\'")); //$NON-NLS-1$
- assertTrue(x.charValue() == '\\');
- }
-
- public void testNumberLiteral() {
- long previousCount = ast.modificationCount();
- NumberLiteral x = ast.newNumberLiteral("1234"); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue("1234".equals(x.getToken())); //$NON-NLS-1$
- assertTrue(x.getNodeType() == ASTNode.NUMBER_LITERAL);
- assertTrue(x.structuralPropertiesForType() == NumberLiteral.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- // test other factory method
- previousCount = ast.modificationCount();
- NumberLiteral y = ast.newNumberLiteral();
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(y.getAST() == ast);
- assertTrue(y.getParent() == null);
- assertTrue("0".equals(y.getToken())); //$NON-NLS-1$
-
- final String[] samples =
- { "0", "1", "1234567890", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "0L", "1L", "1234567890L", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "0l", "1l", "1234567890l", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "077", "0177", "012345670", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "077L", "0177L", "012345670L", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "077l", "0177l", "012345670l", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "0x00", "0x1", "0x0123456789ABCDEF", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "0x00L", "0x1L", "0x0123456789ABCDEFL", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "0x00l", "0x1l", "0x0123456789ABCDEFl", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- "1e1f", "2.f", ".3f", "0f", "3.14f", "6.022137e+23f", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$
- "1e1", "2.", ".3", "0.0", "3.14", "1e-9d", "1e137", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
- };
- for (int i = 0; i < samples.length; i++) {
- previousCount = ast.modificationCount();
- x.setToken(samples[i]);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(samples[i].equals(x.getToken()));
- }
-
- // check that property cannot be set to null
- try {
- x.setToken(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- }
-
- public void testSimpleType() {
- long previousCount = ast.modificationCount();
- final SimpleType x = ast.newSimpleType(ast.newSimpleName("String")); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.isSimpleType());
- assertTrue(!x.isArrayType());
- assertTrue(!x.isPrimitiveType());
- assertTrue(!x.isQualifiedType());
- assertTrue(x.getNodeType() == ASTNode.SIMPLE_TYPE);
- assertTrue(x.structuralPropertiesForType() == SimpleType.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Name", true, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("a"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((Name) value);
- }
- });
- }
-
- public void testPrimitiveType() {
- long previousCount = ast.modificationCount();
- PrimitiveType x = ast.newPrimitiveType(PrimitiveType.INT);
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getPrimitiveTypeCode().equals(PrimitiveType.INT));
- assertTrue(!x.isSimpleType());
- assertTrue(!x.isArrayType());
- assertTrue(x.isPrimitiveType());
- assertTrue(!x.isQualifiedType());
- assertTrue(x.getNodeType() == ASTNode.PRIMITIVE_TYPE);
- assertTrue(x.structuralPropertiesForType() == PrimitiveType.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- // check the names of the primitive type codes
- assertTrue(PrimitiveType.BYTE.toString().equals("byte")); //$NON-NLS-1$
- assertTrue(PrimitiveType.INT.toString().equals("int")); //$NON-NLS-1$
- assertTrue(PrimitiveType.BOOLEAN.toString().equals("boolean")); //$NON-NLS-1$
- assertTrue(PrimitiveType.CHAR.toString().equals("char")); //$NON-NLS-1$
- assertTrue(PrimitiveType.SHORT.toString().equals("short")); //$NON-NLS-1$
- assertTrue(PrimitiveType.LONG.toString().equals("long")); //$NON-NLS-1$
- assertTrue(PrimitiveType.FLOAT.toString().equals("float")); //$NON-NLS-1$
- assertTrue(PrimitiveType.DOUBLE.toString().equals("double")); //$NON-NLS-1$
- assertTrue(PrimitiveType.VOID.toString().equals("void")); //$NON-NLS-1$
-
-
- PrimitiveType.Code[] known = {
- PrimitiveType.BOOLEAN,
- PrimitiveType.BYTE,
- PrimitiveType.CHAR,
- PrimitiveType.INT,
- PrimitiveType.SHORT,
- PrimitiveType.LONG,
- PrimitiveType.FLOAT,
- PrimitiveType.DOUBLE,
- PrimitiveType.VOID,
- };
-
- // check all primitive type codes are distinct
- for (int i = 0; i < known.length; i++) {
- for (int j = 0; j < known.length; j++) {
- assertTrue(i == j || !known[i].equals(known[j]));
- }
- }
-
- // check all primitive type codes work
- for (int i = 0; i < known.length; i++) {
- previousCount = ast.modificationCount();
- x.setPrimitiveTypeCode(known[i]);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getPrimitiveTypeCode().equals(known[i]));
- }
- // ensure null does not work as a primitive type code
- try {
- x.setPrimitiveTypeCode(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- // check toCode lookup of primitive type code by name
- for (int i = 0; i < known.length; i++) {
- String name = known[i].toString();
- assertTrue(PrimitiveType.toCode(name).equals(known[i]));
- }
- assertTrue(PrimitiveType.toCode("not-a-type") == null); //$NON-NLS-1$
- }
-
- public void testArrayType() {
- SimpleName x1 = ast.newSimpleName("String"); //$NON-NLS-1$
- SimpleType x2 = ast.newSimpleType(x1);
- long previousCount = ast.modificationCount();
- final ArrayType x = ast.newArrayType(x2);
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getComponentType().getParent() == x);
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
- assertTrue(!x.isSimpleType());
- assertTrue(x.isArrayType());
- assertTrue(!x.isPrimitiveType());
- assertTrue(!x.isQualifiedType());
- assertTrue(x.getNodeType() == ASTNode.ARRAY_TYPE);
- assertTrue(x.structuralPropertiesForType() == ArrayType.propertyDescriptors(ast.apiLevel()));
-
- assertTrue(x.getDimensions() == 1);
- assertTrue(x.getElementType() == x2);
-
- genericPropertyTest(x, new Property("ComponentType", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(
- targetAst.newSimpleName("a")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode wrap() {
- ArrayType result = ast.newArrayType(x);
- return result;
- }
- public void unwrap() {
- ArrayType a = (ArrayType) x.getParent();
- a.setComponentType(ast.newPrimitiveType(PrimitiveType.INT));
- }
- public ASTNode get() {
- return x.getComponentType();
- }
- public void set(ASTNode value) {
- x.setComponentType((Type) value);
- }
- });
-
- x.setComponentType(
- ast.newArrayType(ast.newPrimitiveType(PrimitiveType.INT), 4));
-
- assertTrue(x.getDimensions() == 5);
- assertTrue(x.getElementType().isPrimitiveType());
- }
-
- /** @deprecated using deprecated code */
- public void testQualifiedType() {
- if (ast.apiLevel() == AST.JLS2) {
- // node type introduced in 3.0 API
- try {
- ast.newQualifiedType(
- ast.newSimpleType(ast.newSimpleName("q")), //$NON-NLS-1$
- ast.newSimpleName("i")); //$NON-NLS-1$
- assertTrue(false);
- } catch (UnsupportedOperationException e) {
- // pass
- }
- return;
- }
- long previousCount = ast.modificationCount();
- final QualifiedType x = ast.newQualifiedType(
- ast.newSimpleType(ast.newSimpleName("q")), //$NON-NLS-1$
- ast.newSimpleName("i")); //$NON-NLS-1$
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getQualifier().getParent() == x);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getName().isDeclaration() == false);
- assertTrue(x.getNodeType() == ASTNode.QUALIFIED_TYPE);
- assertTrue(!x.isSimpleType());
- assertTrue(!x.isArrayType());
- assertTrue(!x.isPrimitiveType());
- assertTrue(x.isQualifiedType());
- assertTrue(x.structuralPropertiesForType() == QualifiedType.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Qualifier", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result =
- targetAst.newSimpleType(
- targetAst.newSimpleName("a")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode wrap() {
- QualifiedType s1 = ast.newQualifiedType(x, ast.newSimpleName("z")); //$NON-NLS-1$
- return s1;
- }
- public void unwrap() {
- QualifiedType s1 = (QualifiedType) x.getParent();
- s1.setQualifier(ast.newSimpleType(ast.newSimpleName("z"))); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getQualifier();
- }
- public void set(ASTNode value) {
- x.setQualifier((Type) value);
- }
- });
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
- }
-
- public void testPackageDeclaration() {
- long previousCount = ast.modificationCount();
- final PackageDeclaration x = ast.newPackageDeclaration();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- if (ast.apiLevel() >= AST.JLS3) {
- assertTrue(x.getJavadoc() == null);
- assertTrue(x.annotations().isEmpty());
- }
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.PACKAGE_DECLARATION);
- assertTrue(x.structuralPropertiesForType() == PackageDeclaration.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- if (ast.apiLevel() >= AST.JLS3) {
- genericPropertyTest(x, new Property("Javadoc", false, JSdoc.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- JSdoc result = targetAst.newJSdoc();
- if (parented) {
- targetAst.newInitializer().setJavadoc(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getJavadoc();
- }
- public void set(ASTNode value) {
- x.setJavadoc((JSdoc) value);
- }
- });
-
-
- }
-
- genericPropertyTest(x, new Property("Name", true, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("a"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((Name) value);
- }
- });
- }
-
- public void testImportDeclaration() {
- long previousCount = ast.modificationCount();
- final ImportDeclaration x = ast.newImportDeclaration();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.isOnDemand() == false);
- if (ast.apiLevel() >= AST.JLS3) {
- assertTrue(x.isStatic() == false);
- }
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getNodeType() == ASTNode.IMPORT_DECLARATION);
- assertTrue(x.structuralPropertiesForType() == ImportDeclaration.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Name", true, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("a"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((Name) value);
- }
- });
-
- previousCount = ast.modificationCount();
- x.setOnDemand(false);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.isOnDemand() == false);
- previousCount = ast.modificationCount();
- x.setOnDemand(true);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.isOnDemand() == true);
-
- if (ast.apiLevel() >= AST.JLS3) {
- x.setStatic(true);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.isStatic() == true);
- }
- }
-
- public void testCompilationUnit() {
- long previousCount = ast.modificationCount();
- final JavaScriptUnit x = ast.newJavaScriptUnit();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getPackage() == null);
- assertTrue(x.imports().size() == 0);
- assertTrue(x.types().size() == 0);
- assertTrue(x.getNodeType() == ASTNode.JAVASCRIPT_UNIT);
- assertTrue(x.structuralPropertiesForType() == JavaScriptUnit.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tClientProperties(x);
-
- genericPropertyTest(x, new Property("Package", false, PackageDeclaration.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- PackageDeclaration result = targetAst.newPackageDeclaration();
- if (parented) {
- JavaScriptUnit cu = targetAst.newJavaScriptUnit();
- cu.setPackage(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getPackage();
- }
- public void set(ASTNode value) {
- x.setPackage((PackageDeclaration) value);
- }
- });
-
- genericPropertyListTest(x, x.imports(), new Property("Imports", true, ImportDeclaration.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- ImportDeclaration result = targetAst.newImportDeclaration();
- if (parented) {
- JavaScriptUnit cu = targetAst.newJavaScriptUnit();
- cu.imports().add(result);
- }
- return result;
- }
- });
-
- genericPropertyListTest(x, x.types(), new Property("Types", true, AbstractTypeDeclaration.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- TypeDeclaration result = targetAst.newTypeDeclaration();
- if (parented) {
- JavaScriptUnit cu = targetAst.newJavaScriptUnit();
- cu.types().add(result);
- }
- return result;
- }
- });
-
- // check that TypeDeclarations in body are classified correctly
- TypeDeclaration t1 = ast.newTypeDeclaration();
- x.types().add(t1);
- assertTrue(t1.isLocalTypeDeclaration() == false);
- assertTrue(t1.isMemberTypeDeclaration() == false);
- assertTrue(t1.isPackageMemberTypeDeclaration() == true);
-
- }
-
- public void testCompilationUnitLineNumberTable() {
-// TO RUN THIS TEST YOU MUST TEMPORARILY MAKE PUBLIC
-// THE METHOD JavaScriptUnit.setLineEndTable
-
-// final JavaScriptUnit x = ast.newCompilationUnit();
-//
-// // table starts off empty
-// for (int i= -10; i < 10; i++) {
-// assertTrue(x.lineNumber(i) == 1);
-// }
-//
-// // supply a simple line table to test
-// String s = "AA\nBBB\nCC\nDDDD\nEEE";
-// assertTrue(s.length() == 18); // cross check
-// int le[] = new int[5];
-// le[0] = s.indexOf('\n');
-// le[1] = s.indexOf('\n', le[0] + 1);
-// le[2] = s.indexOf('\n', le[1] + 1);
-// le[3] = s.indexOf('\n', le[2] + 1);
-// le[4] = s.length() - 1;
-// long previousCount = ast.modificationCount();
-// x.setLineEndTable(le);
-// assertTrue(ast.modificationCount() > previousCount);
-//
-// assertTrue(x.lineNumber(0) == 1);
-// assertTrue(x.lineNumber(1) == 1);
-// assertTrue(x.lineNumber(2) == 1);
-// assertTrue(x.lineNumber(3) == 2);
-// assertTrue(x.lineNumber(4) == 2);
-// assertTrue(x.lineNumber(5) == 2);
-// assertTrue(x.lineNumber(6) == 2);
-// assertTrue(x.lineNumber(7) == 3);
-// assertTrue(x.lineNumber(8) == 3);
-// assertTrue(x.lineNumber(9) == 3);
-// assertTrue(x.lineNumber(10) == 4);
-// assertTrue(x.lineNumber(11) == 4);
-// assertTrue(x.lineNumber(12) == 4);
-// assertTrue(x.lineNumber(13) == 4);
-// assertTrue(x.lineNumber(14) == 4);
-// assertTrue(x.lineNumber(15) == 5);
-// assertTrue(x.lineNumber(16) == 5);
-// assertTrue(x.lineNumber(17) == 5);
-//
-// assertTrue(x.lineNumber(18) == 1);
-// assertTrue(x.lineNumber(100) == 1);
-// assertTrue(x.lineNumber(1000000) == 1);
-// assertTrue(x.lineNumber(-1) == 1);
-// assertTrue(x.lineNumber(-100) == 1);
-// assertTrue(x.lineNumber(-1000000) == 1);
-//
-// // slam table back to none
-// x.setLineEndTable(new int[0]);
-// for (int i= -10; i < 10; i++) {
-// assertTrue(x.lineNumber(i) == 1);
-// }
- }
-
- /** @deprecated using deprecated code */
- public void testTypeDeclaration() {
- long previousCount = ast.modificationCount();
- final TypeDeclaration x = ast.newTypeDeclaration();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- if (ast.apiLevel() == AST.JLS2) {
- assertTrue(x.getModifiers() == Modifier.NONE);
- assertTrue(x.getSuperclass() == null);
- } else {
- assertTrue(x.modifiers().size() == 0);
- assertTrue(x.getSuperclassType() == null);
- }
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getName().isDeclaration() == true);
- assertTrue(x.getJavadoc() == null);
- assertTrue(x.bodyDeclarations().size()== 0);
- assertTrue(x.getNodeType() == ASTNode.TYPE_DECLARATION);
- assertTrue(x.structuralPropertiesForType() == TypeDeclaration.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
-
- if (ast.apiLevel() == AST.JLS2) {
- int legal = Modifier.PUBLIC | Modifier.PROTECTED
- | Modifier.PRIVATE | Modifier.ABSTRACT | Modifier.STATIC
- | Modifier.FINAL | Modifier.STRICTFP;
- previousCount = ast.modificationCount();
- x.setModifiers(legal);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == legal);
-
- previousCount = ast.modificationCount();
- x.setModifiers(Modifier.NONE);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == Modifier.NONE);
- }
-
- tJavadocComment(x);
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
-
- if (ast.apiLevel() == AST.JLS2) {
- genericPropertyTest(x, new Property("Superclass", false, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getSuperclass();
- }
- public void set(ASTNode value) {
- x.setSuperclass((Name) value);
- }
- });
- }
-
- if (ast.apiLevel() >= AST.JLS3) {
- genericPropertyTest(x, new Property("SuperclassType", false, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(targetAst.newSimpleName("foo")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getSuperclassType();
- }
- public void set(ASTNode value) {
- x.setSuperclassType((Type) value);
- }
- });
- }
-
- if (ast.apiLevel() >= AST.JLS3) {
- genericPropertyListTest(x, null,
- new Property("SuperInterfaceTypes", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(targetAst.newSimpleName("foo")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- });
- }
-
-
- genericPropertyListTest(x, x.bodyDeclarations(),
- new Property("BodyDeclarations", true, BodyDeclaration.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- TypeDeclaration result = targetAst.newTypeDeclaration();
- if (parented) {
- JavaScriptUnit cu = targetAst.newJavaScriptUnit();
- cu.types().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- TypeDeclaration s1 = x.getAST().newTypeDeclaration();
- s1.bodyDeclarations().add(x);
- return s1;
- }
- public void unwrap() {
- TypeDeclaration s1 = (TypeDeclaration) x.getParent();
- s1.bodyDeclarations().remove(x);
- }
- });
-
- // check special bodyDeclaration methods
- x.bodyDeclarations().clear();
- FieldDeclaration f1 = ast.newFieldDeclaration(ast.newVariableDeclarationFragment());
- FieldDeclaration f2 = ast.newFieldDeclaration(ast.newVariableDeclarationFragment());
- FunctionDeclaration m1 = ast.newFunctionDeclaration();
- FunctionDeclaration m2 = ast.newFunctionDeclaration();
- TypeDeclaration t1 = ast.newTypeDeclaration();
- TypeDeclaration t2 = ast.newTypeDeclaration();
-
-
- x.bodyDeclarations().add(ast.newInitializer());
- x.bodyDeclarations().add(f1);
- x.bodyDeclarations().add(ast.newInitializer());
- x.bodyDeclarations().add(f2);
- x.bodyDeclarations().add(ast.newInitializer());
- x.bodyDeclarations().add(t1);
- x.bodyDeclarations().add(ast.newInitializer());
- x.bodyDeclarations().add(m1);
- x.bodyDeclarations().add(ast.newInitializer());
- x.bodyDeclarations().add(m2);
- x.bodyDeclarations().add(ast.newInitializer());
- x.bodyDeclarations().add(t2);
- x.bodyDeclarations().add(ast.newInitializer());
-
- List fs = Arrays.asList(x.getFields());
- assertTrue(fs.size() == 2);
- assertTrue(fs.contains(f1));
- assertTrue(fs.contains(f2));
-
- List ms = Arrays.asList(x.getMethods());
- assertTrue(ms.size() == 2);
- assertTrue(ms.contains(m1));
- assertTrue(ms.contains(m2));
-
- List ts = Arrays.asList(x.getTypes());
- assertTrue(ts.size() == 2);
- assertTrue(ts.contains(t1));
- assertTrue(ts.contains(t2));
-
- // check that TypeDeclarations in body are classified correctly
- assertTrue(t1.isLocalTypeDeclaration() == false);
- assertTrue(t1.isMemberTypeDeclaration() == true);
- assertTrue(t1.isPackageMemberTypeDeclaration() == false);
-
- }
-
- /** @deprecated using deprecated code */
- public void testSingleVariableDeclaration() {
- long previousCount = ast.modificationCount();
- final SingleVariableDeclaration x = ast.newSingleVariableDeclaration();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- if (ast.apiLevel() == AST.JLS2) {
- assertTrue(x.getModifiers() == Modifier.NONE);
- } else {
- assertTrue(x.modifiers().size() == 0);
- assertTrue(x.isVarargs() == false);
- }
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getName().isDeclaration() == true);
- assertTrue(x.getType().getParent() == x);
- assertTrue(x.getExtraDimensions() == 0);
- assertTrue(x.getInitializer() == null);
- assertTrue(x.getNodeType() == ASTNode.SINGLE_VARIABLE_DECLARATION);
- assertTrue(x.structuralPropertiesForType() == SingleVariableDeclaration.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- if (ast.apiLevel() == AST.JLS2) {
- int legal = Modifier.PUBLIC | Modifier.PROTECTED
- | Modifier.PRIVATE | Modifier.STATIC | Modifier.FINAL
- | Modifier.TRANSIENT | Modifier.VOLATILE;
- previousCount = ast.modificationCount();
- x.setModifiers(legal);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == legal);
-
- previousCount = ast.modificationCount();
- x.setModifiers(Modifier.NONE);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == Modifier.NONE);
- }
-
- previousCount = ast.modificationCount();
- x.setExtraDimensions(1);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getExtraDimensions() == 1);
-
- previousCount = ast.modificationCount();
- x.setExtraDimensions(0);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getExtraDimensions() == 0);
-
- if (ast.apiLevel() >= AST.JLS3) {
- previousCount = ast.modificationCount();
- x.setVarargs(true);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.isVarargs() == true);
-
- previousCount = ast.modificationCount();
- x.setVarargs(false);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.isVarargs() == false);
- }
-
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
-
- genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(
- targetAst.newSimpleName("foo")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getType();
- }
- public void set(ASTNode value) {
- x.setType((Type) value);
- }
- });
-
- genericPropertyTest(x, new Property("Initializer", false, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return an Expression that embeds x
- CatchClause s1 = ast.newCatchClause();
- s1.setException(x);
- return s1;
- }
- public void unwrap() {
- CatchClause s1 = (CatchClause) x.getParent();
- s1.setException(ast.newSingleVariableDeclaration());
- }
- public ASTNode get() {
- return x.getInitializer();
- }
- public void set(ASTNode value) {
- x.setInitializer((Expression) value);
- }
- });
- }
-
- public void testVariableDeclarationFragment() {
- long previousCount = ast.modificationCount();
- final VariableDeclarationFragment x = ast.newVariableDeclarationFragment();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.getName().isDeclaration() == true);
- assertTrue(x.getExtraDimensions() == 0);
- assertTrue(x.getInitializer() == null);
- assertTrue(x.getNodeType() == ASTNode.VARIABLE_DECLARATION_FRAGMENT);
- assertTrue(x.structuralPropertiesForType() ==
- VariableDeclarationFragment.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
- x.setExtraDimensions(1);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getExtraDimensions() == 1);
-
- previousCount = ast.modificationCount();
- x.setExtraDimensions(0);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getExtraDimensions() == 0);
-
- // check that property cannot be set negative
- try {
- x.setExtraDimensions(-1);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
-
- genericPropertyTest(x, new Property("Initializer", false, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return an Expression that embeds x
- VariableDeclarationExpression s1 =
- ast.newVariableDeclarationExpression(x);
- return s1;
- }
- public void unwrap() {
- VariableDeclarationExpression s1 =
- (VariableDeclarationExpression) x.getParent();
- s1.fragments().remove(x);
- }
- public ASTNode get() {
- return x.getInitializer();
- }
- public void set(ASTNode value) {
- x.setInitializer((Expression) value);
- }
- });
- }
-
- /** @deprecated using deprecated code */
- public void testMethodDeclaration() {
- long previousCount = ast.modificationCount();
- final FunctionDeclaration x = ast.newFunctionDeclaration();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- if (ast.apiLevel() == AST.JLS2) {
- assertTrue(x.getModifiers() == Modifier.NONE);
- assertTrue(x.getReturnType().getParent() == x);
- assertTrue(x.getReturnType().isPrimitiveType());
- assertTrue(((PrimitiveType) x.getReturnType()).getPrimitiveTypeCode() == PrimitiveType.VOID);
- } else {
- assertTrue(x.modifiers().size() == 0);
- assertTrue(x.getReturnType2().getParent() == x);
- assertTrue(x.getReturnType2().isPrimitiveType());
- assertTrue(((PrimitiveType) x.getReturnType2()).getPrimitiveTypeCode() == PrimitiveType.VOID);
- }
- assertTrue(x.isConstructor() == false);
- //assertTrue(x.getName().getParent() == x);
- //assertTrue(x.getName().isDeclaration() == true);
- assertTrue(x.getExtraDimensions() == 0);
- assertTrue(x.getJavadoc() == null);
- assertTrue(x.parameters().size() == 0);
- assertTrue(x.thrownExceptions().size() == 0);
- assertTrue(x.getBody() == null);
- assertTrue(x.getNodeType() == ASTNode.FUNCTION_DECLARATION);
- assertTrue(x.structuralPropertiesForType() ==
- FunctionDeclaration.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- previousCount = ast.modificationCount();
- x.setConstructor(true);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.isConstructor() == true);
- //assertTrue(x.getName().isDeclaration() == false);
-
- previousCount = ast.modificationCount();
- x.setConstructor(false);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.isConstructor() == false);
-
- if (ast.apiLevel() == AST.JLS2) {
- previousCount = ast.modificationCount();
- int legal = Modifier.PUBLIC | Modifier.PROTECTED
- | Modifier.PRIVATE | Modifier.ABSTRACT | Modifier.STATIC
- | Modifier.FINAL | Modifier.SYNCHRONIZED| Modifier.NATIVE
- | Modifier.STRICTFP;
- x.setModifiers(legal);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == legal);
-
- previousCount = ast.modificationCount();
- x.setModifiers(Modifier.NONE);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == Modifier.NONE);
- }
-
- previousCount = ast.modificationCount();
- x.setExtraDimensions(1);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getExtraDimensions() == 1);
-
- previousCount = ast.modificationCount();
- x.setExtraDimensions(0);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getExtraDimensions() == 0);
-
- tJavadocComment(x);
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
-
- if (ast.apiLevel() == AST.JLS2) {
- genericPropertyTest(x, new Property("ReturnType", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(
- targetAst.newSimpleName("foo")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getReturnType();
- }
- public void set(ASTNode value) {
- x.setReturnType((Type) value);
- }
- });
- }
-
- if (ast.apiLevel() >= AST.JLS3) {
- genericPropertyTest(x, new Property("ReturnType2", false, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(
- targetAst.newSimpleName("foo")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getReturnType2();
- }
- public void set(ASTNode value) {
- x.setReturnType2((Type) value);
- }
- });
- }
-
- genericPropertyListTest(x, x.parameters(),
- new Property("Parameters", true, SingleVariableDeclaration.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SingleVariableDeclaration result = targetAst.newSingleVariableDeclaration();
- if (parented) {
- targetAst.newCatchClause().setException(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a SingleVariableDeclaration that embeds x
- SingleVariableDeclaration s1 = ast.newSingleVariableDeclaration();
- ClassInstanceCreation s2 = ast.newClassInstanceCreation();
- AnonymousClassDeclaration a1 = ast.newAnonymousClassDeclaration();
- s2.setAnonymousClassDeclaration(a1);
- s1.setInitializer(s2);
- a1.bodyDeclarations().add(x);
- return s1;
- }
- public void unwrap() {
- AnonymousClassDeclaration a1 = (AnonymousClassDeclaration) x.getParent();
- a1.bodyDeclarations().remove(x);
- }
- });
-
- genericPropertyListTest(x, x.thrownExceptions(),
- new Property("ThrownExceptions", true, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- });
-
- genericPropertyTest(x, new Property("Body", false, Block.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Block that embeds x
- Block s1 = ast.newBlock();
- TypeDeclaration s2 = ast.newTypeDeclaration();
- s1.statements().add(ast.newTypeDeclarationStatement(s2));
- s2.bodyDeclarations().add(x);
- return s1;
- }
- public void unwrap() {
- TypeDeclaration s2 = (TypeDeclaration) x.getParent();
- s2.bodyDeclarations().remove(x);
- }
- public ASTNode get() {
- return x.getBody();
- }
- public void set(ASTNode value) {
- x.setBody((Block) value);
- }
- });
-
- if (ast.apiLevel() >= AST.JLS3) {
- // check isVariableArity convenience method
- x.parameters().clear();
- assertTrue(!x.isVarargs()); // 0 params
- x.parameters().add(ast.newSingleVariableDeclaration());
- assertTrue(!x.isVarargs()); // 1 params
- SingleVariableDeclaration v = ast.newSingleVariableDeclaration();
- x.parameters().add(v);
- assertTrue(!x.isVarargs()); // 2 param fixed arity
- v.setVarargs(true);
- assertTrue(x.isVarargs()); // 2 param fixed arity
- x.parameters().add(ast.newSingleVariableDeclaration());
- assertTrue(!x.isVarargs()); // only last param counts
- }
- }
-
- /** @deprecated using deprecated code */
- public void testInitializer() {
- long previousCount = ast.modificationCount();
- final Initializer x = ast.newInitializer();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getJavadoc() == null);
- if (ast.apiLevel() == AST.JLS2) {
- assertTrue(x.getModifiers() == Modifier.NONE);
- } else {
- assertTrue(x.modifiers().size() == 0);
- }
- assertTrue(x.getBody().getParent() == x);
- assertTrue(x.getBody().statements().size() == 0);
- assertTrue(x.getNodeType() == ASTNode.INITIALIZER);
- assertTrue(x.structuralPropertiesForType() ==
- Initializer.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tJavadocComment(x);
-
- if (ast.apiLevel() == AST.JLS2) {
- int legal = Modifier.STATIC;
- previousCount = ast.modificationCount();
- x.setModifiers(legal);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == legal);
-
- previousCount = ast.modificationCount();
- x.setModifiers(Modifier.NONE);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getModifiers() == Modifier.NONE);
- }
-
- genericPropertyTest(x, new Property("Body", true, Block.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Block that embeds x
- Block s1 = ast.newBlock();
- TypeDeclaration s2 = ast.newTypeDeclaration();
- s1.statements().add(ast.newTypeDeclarationStatement(s2));
- s2.bodyDeclarations().add(x);
- return s1;
- }
- public void unwrap() {
- TypeDeclaration s2 = (TypeDeclaration) x.getParent();
- s2.bodyDeclarations().remove(x);
- }
- public ASTNode get() {
- return x.getBody();
- }
- public void set(ASTNode value) {
- x.setBody((Block) value);
- }
- });
- }
-
- /**
- * @deprecated (not really - its just that Javadoc.get/setComment
- * are deprecated, and this suppresses the extra warnings)
- */
- public void testJavadoc() {
- long previousCount = ast.modificationCount();
- final JSdoc x = ast.newJSdoc();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- if (ast.apiLevel() == AST.JLS2) {
- assertTrue(x.getComment().startsWith("/**")); //$NON-NLS-1$
- assertTrue(x.getComment().endsWith("*/")); //$NON-NLS-1$
- }
- assertTrue(x.getNodeType() == ASTNode.JSDOC);
- assertTrue(!x.isBlockComment());
- assertTrue(!x.isLineComment());
- assertTrue(x.isDocComment());
- assertTrue(x.tags().isEmpty());
- assertTrue(x.getAlternateRoot() == null);
- assertTrue(x.structuralPropertiesForType() ==
- JSdoc.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- // check the constants
- assertTrue(TagElement.TAG_AUTHOR.equals("@author")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_DEPRECATED.equals("@deprecated")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_DOCROOT.equals("@docRoot")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_EXCEPTION.equals("@exception")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_INHERITDOC.equals("@inheritDoc")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_LINK.equals("@link")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_LINKPLAIN.equals("@linkplain")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_PARAM.equals("@param")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_RETURN.equals("@return")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_SEE.equals("@see")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_SERIAL.equals("@serial")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_SERIALDATA.equals("@serialData")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_SERIALFIELD.equals("@serialField")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_SINCE.equals("@since")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_THROWS.equals("@throws")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_VALUE.equals("@value")); //$NON-NLS-1$
- assertTrue(TagElement.TAG_VERSION.equals("@version")); //$NON-NLS-1$
-
- if (ast.apiLevel() == AST.JLS2) {
- final String[] samples =
- {
- "/** Hello there */", //$NON-NLS-1$
- "/**\n * Line 1\n * Line 2\n */", //$NON-NLS-1$
- "/***/", //$NON-NLS-1$
- };
- for (int i = 0; i < samples.length; i++) {
- previousCount = ast.modificationCount();
- x.setComment(samples[i]);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(samples[i].equals(x.getComment()));
- }
-
- final String[] badSamples =
- {
- null,
- "", //$NON-NLS-1$
- "/* */", //$NON-NLS-1$
- "/**", //$NON-NLS-1$
- "*/", //$NON-NLS-1$
- };
-
- // check that property cannot be set to clearly illegal things
- for (int i = 0; i < badSamples.length; i++) {
- try {
- x.setComment(badSamples[i]);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
- }
- }
-
- tAlternateRoot(x);
-
- genericPropertyListTest(x, x.tags(),
- new Property("Tags", true, TagElement.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- TagElement result = targetAst.newTagElement();
- if (parented) {
- JSdoc parent = targetAst.newJSdoc();
- parent.tags().add(result);
- }
- return result;
- }
- public ASTNode[] counterExamples(AST targetAst) {
- return new ASTNode[] {
- targetAst.newEmptyStatement(),
- targetAst.newJavaScriptUnit(),
- targetAst.newTypeDeclaration(),
- targetAst.newJSdoc(),
- targetAst.newTextElement(),
- targetAst.newFunctionRef()
- };
- }
- });
- }
-
- public void testBlockComment() {
- long previousCount = ast.modificationCount();
- final BlockComment x = ast.newBlockComment();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getNodeType() == ASTNode.BLOCK_COMMENT);
- assertTrue(x.isBlockComment());
- assertTrue(!x.isLineComment());
- assertTrue(!x.isDocComment());
- assertTrue(x.getAlternateRoot() == null);
- assertTrue(x.structuralPropertiesForType() ==
- BlockComment.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tAlternateRoot(x);
- }
-
- public void testLineComment() {
- long previousCount = ast.modificationCount();
- final LineComment x = ast.newLineComment();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getNodeType() == ASTNode.LINE_COMMENT);
- assertTrue(!x.isBlockComment());
- assertTrue(x.isLineComment());
- assertTrue(!x.isDocComment());
- assertTrue(x.getAlternateRoot() == null);
- assertTrue(x.structuralPropertiesForType() ==
- LineComment.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tAlternateRoot(x);
- }
-
- public void testTagElement() {
- long previousCount = ast.modificationCount();
- final TagElement x = ast.newTagElement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getNodeType() == ASTNode.TAG_ELEMENT);
- assertTrue(x.getTagName() == null);
- assertTrue(x.fragments().isEmpty());
- assertTrue(x.structuralPropertiesForType() ==
- TagElement.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- // tagName property
- previousCount = ast.modificationCount();
- String s1 = new String("hello"); //$NON-NLS-1$
- x.setTagName(s1);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getTagName() == s1);
- previousCount = ast.modificationCount();
- String s2 = new String("bye"); //$NON-NLS-1$
- x.setTagName(s2);
- assertTrue(x.getTagName() == s2);
- assertTrue(ast.modificationCount() > previousCount);
- x.setTagName(null);
- assertTrue(x.getTagName() == null);
- assertTrue(ast.modificationCount() > previousCount);
-
- // check that fragments() can handle TagElement
- genericPropertyListTest(x, x.fragments(),
- new Property("Fragments", true, TagElement.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- TagElement result = targetAst.newTagElement();
- if (parented) {
- JSdoc parent = targetAst.newJSdoc();
- parent.tags().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return TagElement that embeds x
- TagElement tagElement = ast.newTagElement();
- tagElement.fragments().add(x);
- return tagElement;
- }
- public void unwrap() {
- TagElement tagElement = (TagElement) x.getParent();
- tagElement.fragments().remove(x);
- }
- public ASTNode[] counterExamples(AST targetAst) {
- return new ASTNode[] {
- targetAst.newEmptyStatement(),
- targetAst.newJavaScriptUnit(),
- targetAst.newTypeDeclaration(),
- targetAst.newJSdoc(),
- };
- }
- });
- // check that fragments() can handle Name
- genericPropertyListTest(x, x.fragments(),
- new Property("Fragments", true, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- });
- // check that fragments() can handle TextElement
- genericPropertyListTest(x, x.fragments(),
- new Property("Fragments", true, TextElement.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- TextElement result = targetAst.newTextElement();
- if (parented) {
- TagElement parent = targetAst.newTagElement();
- parent.fragments().add(result);
- }
- return result;
- }
- });
- // check that fragments() can handle FunctionRef
- genericPropertyListTest(x, x.fragments(),
- new Property("Fragments", true, FunctionRef.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- FunctionRef result = targetAst.newFunctionRef();
- if (parented) {
- TagElement parent = targetAst.newTagElement();
- parent.fragments().add(result);
- }
- return result;
- }
- });
- // check that fragments() can handle MemberRef
- genericPropertyListTest(x, x.fragments(),
- new Property("Fragments", true, MemberRef.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- MemberRef result = targetAst.newMemberRef();
- if (parented) {
- TagElement parent = targetAst.newTagElement();
- parent.fragments().add(result);
- }
- return result;
- }
- });
- }
-
- public void testTextElement() {
- long previousCount = ast.modificationCount();
- final TextElement x = ast.newTextElement();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getNodeType() == ASTNode.TEXT_ELEMENT);
- assertTrue(x.getText().length() == 0);
- assertTrue(x.structuralPropertiesForType() ==
- TextElement.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- // text property
- previousCount = ast.modificationCount();
- String s1 = new String("hello");
- x.setText(s1);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.getText() == s1);
- previousCount = ast.modificationCount();
- String s2 = new String("");
- x.setText(s2);
- assertTrue(x.getText() == s2);
- assertTrue(ast.modificationCount() > previousCount);
- // check that property cannot be set to null
- previousCount = ast.modificationCount();
- try {
- x.setText(null);
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
- assertTrue(ast.modificationCount() == previousCount);
- // check that property cannot include */
- previousCount = ast.modificationCount();
- try {
- x.setText("this would be the */ end of it"); //$NON-NLS-1$
- assertTrue(false);
- } catch (RuntimeException e) {
- // pass
- }
- assertTrue(ast.modificationCount() == previousCount);
- }
-
- public void testMemberRef() {
- long previousCount = ast.modificationCount();
- final MemberRef x = ast.newMemberRef();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getNodeType() == ASTNode.MEMBER_REF);
- assertTrue(x.getQualifier() == null);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.structuralPropertiesForType() ==
- MemberRef.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Qualifier", false, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- QualifiedName result = targetAst.newQualifiedName(
- targetAst.newSimpleName("a"), //$NON-NLS-1$
- targetAst.newSimpleName("b")); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getQualifier();
- }
- public void set(ASTNode value) {
- x.setQualifier((Name) value);
- }
- });
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
- }
-
- public void testMethodRef() {
- long previousCount = ast.modificationCount();
- final FunctionRef x = ast.newFunctionRef();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getNodeType() == ASTNode.FUNCTION_REF);
- assertTrue(x.getQualifier() == null);
- assertTrue(x.getName().getParent() == x);
- assertTrue(x.parameters().isEmpty());
- assertTrue(x.structuralPropertiesForType() ==
- FunctionRef.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Qualifier", false, Name.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- QualifiedName result = targetAst.newQualifiedName(
- targetAst.newSimpleName("a"), //$NON-NLS-1$
- targetAst.newSimpleName("b")); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getQualifier();
- }
- public void set(ASTNode value) {
- x.setQualifier((Name) value);
- }
- });
-
- genericPropertyTest(x, new Property("Name", true, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
-
- genericPropertyListTest(x, x.parameters(),
- new Property("Parameters", true, FunctionRefParameter.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- FunctionRefParameter result = targetAst.newFunctionRefParameter();
- if (parented) {
- FunctionRef parent = targetAst.newFunctionRef();
- parent.parameters().add(result);
- }
- return result;
- }
- });
- }
-
- public void testMethodRefParameter() {
- long previousCount = ast.modificationCount();
- final FunctionRefParameter x = ast.newFunctionRefParameter();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.getNodeType() == ASTNode.FUNCTION_REF_PARAMETER);
- assertTrue(x.getType().getParent() == x);
- if (ast.apiLevel() >= AST.JLS3) {
- assertTrue(x.isVarargs() == false);
- }
- assertTrue(x.getName() == null);
- assertTrue(x.structuralPropertiesForType() ==
- FunctionRefParameter.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- if (ast.apiLevel() >= AST.JLS3) {
- previousCount = ast.modificationCount();
- x.setVarargs(true);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.isVarargs() == true);
-
- previousCount = ast.modificationCount();
- x.setVarargs(false);
- assertTrue(ast.modificationCount() > previousCount);
- assertTrue(x.isVarargs() == false);
- }
-
- genericPropertyTest(x, new Property("Type", true, Type.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleType result = targetAst.newSimpleType(
- targetAst.newSimpleName("foo")); //$NON-NLS-1$
- if (parented) {
- targetAst.newArrayType(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getType();
- }
- public void set(ASTNode value) {
- x.setType((Type) value);
- }
- });
-
- genericPropertyTest(x, new Property("Name", false, SimpleName.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode get() {
- return x.getName();
- }
- public void set(ASTNode value) {
- x.setName((SimpleName) value);
- }
- });
- }
-
- public void testBlock() {
- long previousCount = ast.modificationCount();
- final Block x = ast.newBlock();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- assertTrue(x.statements().size() == 0);
- assertTrue(x.getNodeType() == ASTNode.BLOCK);
- assertTrue(x.structuralPropertiesForType() ==
- Block.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- tLeadingComment(x);
-
- genericPropertyListTest(x, x.statements(),
- new Property("Statements", true, Statement.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- Block result = targetAst.newBlock();
- if (parented) {
- Block b2 = targetAst.newBlock();
- b2.statements().add(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return a Statement that embeds x
- Block s1 = ast.newBlock();
- s1.statements().add(x);
- return s1;
- }
- public void unwrap() {
- Block s2 = (Block) x.getParent();
- s2.statements().remove(x);
- }
- });
- }
-
- public void testMethodInvocation() {
- long previousCount = ast.modificationCount();
- final FunctionInvocation x = ast.newFunctionInvocation();
- assertTrue(ast.modificationCount() > previousCount);
- previousCount = ast.modificationCount();
- assertTrue(x.getAST() == ast);
- assertTrue(x.getParent() == null);
- if (ast.apiLevel() >= AST.JLS3) {
- assertTrue(x.typeArguments().isEmpty());
- }
- //assertTrue(x.getName().getParent() == x);
- assertTrue(x.getExpression() == null);
- assertTrue(x.arguments().size() == 0);
- assertTrue(x.getNodeType() == ASTNode.FUNCTION_INVOCATION);
- assertTrue(x.structuralPropertiesForType() ==
- FunctionInvocation.propertyDescriptors(ast.apiLevel()));
- // make sure that reading did not change modification count
- assertTrue(ast.modificationCount() == previousCount);
-
- genericPropertyTest(x, new Property("Expression", false, Expression.class) { //$NON-NLS-1$
- public ASTNode sample(AST targetAst, boolean parented) {
- SimpleName result = targetAst.newSimpleName("foo"); //$NON-NLS-1$
- if (parented) {
- targetAst.newExpressionStatement(result);
- }
- return result;
- }
- public ASTNode wrap() {
- // return Expression that embeds x
- ParenthesizedExpression s1 = ast.newParenthesizedExpression();
- s1.setExpression(x);
- return s1;
- }
- public void unwrap() {
- ParenthesizedExpression s1 = (ParenthesizedExpression) x.getParent();
- s1.setExpression(ast.newSimpleName("x")); //$NON-NLS-1$
- }
- public ASTNode get() {
- return x.getExpression();
- }
- public void set(ASTNode value) {
- x.setExpression((Expression) value);
- }
- });
-
- if (ast.apiLevel()