Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect startPosition of a SingleVariableDeclaration in the catch block #2849

Conversation

subyssurendran666
Copy link
Contributor

@subyssurendran666 subyssurendran666 commented Aug 22, 2024

What it does

#2564

How to test

Author checklist

jarthana and others added 30 commits April 5, 2024 13:28
# Conflicts:
#	org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/impl/JavaFeature.java
#	org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Parser.java
#	org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/Scanner.java
#	org.eclipse.jdt.core.compiler.batch/src/org/eclipse/jdt/internal/compiler/parser/parser20.rsc
#	org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/parser/ComplianceDiagnoseTest.java
#	org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_3.java
#	org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_4.java
#	org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/Compliance_1_5.java
#	org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/RecordsRestrictedClassTest.java
#	org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SealedTypesTests.java
#	org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
#	org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StringTemplateComponent.java
#	org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StringTemplateExpression.java
#	org.eclipse.jdt.core/model/org/eclipse/jdt/core/JavaCore.java
# Conflicts:
#	org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTStructuralPropertyTest.java
#	org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/dom/ASTTest.java
#	org.eclipse.jdt.core/.settings/.api_filters
#	org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/AST.java
#	org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/ASTNode.java

Change-Id: I4c62b1c99d15864bee1b82d4a2ac56c9be5c1ad0
…nstanceof, and Switch patterns (#2499)

* Issue #2298 - EP 455: Primitive Types in Patterns, instanceof, and
switch (Preview)

* Widening primitive conversion part

* Narrowing Primitive conversion

* Fixing the Testall and the NPE issue

* Fixing the test case issues due to features becoming standard or another
one becoming extinct

* widening and narrowing primitive conversion

- Rest of it will be addressed in subsequent pull requests
+ grammar & scanner
  - distinguish "import module.foo;" vs. "import module foo;"
    - even within module-info.java
+ resolving
+ errors reporting
+ implement reads() as reflexive property

general test work:
+ pull up reusable methods to new AbstractModuleCompilationTest
+ for tests using writeFilesCollecting
  + ensure testFileNames!=null implies shouldFlush*=false
+ run.javac improved for runConformModuleTest()
+ adjust ModuleCompilationTests.testReleaseOption15: new javac warn
specific tests regarding:
+ shadowing
+ ambiguity
+ accessibility
+ packages from requires transitive
+ redundant imports (flag as unused)
+ module import in CU in unnamed module
+ ambiguity from just one module import

fixes #2383

squashed version of
#2496
# Conflicts:
#	org.eclipse.jdt.core.compiler.batch/META-INF/MANIFEST.MF
#	org.eclipse.jdt.core.compiler.batch/pom.xml
#	org.eclipse.jdt.core.tests.compiler/META-INF/MANIFEST.MF
#	org.eclipse.jdt.core.tests.compiler/pom.xml
#	org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/SwitchPatternTest21.java
#	org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/TestAll.java
#	org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UnnamedPatternsAndVariablesTest.java
#	org.eclipse.jdt.core.tests.compiler/src/org/eclipse/jdt/core/tests/compiler/regression/UseOfUnderscoreJava22Test.java
#	org.eclipse.jdt.core.tests.model/JCL/build.xml
#	org.eclipse.jdt.core.tests.model/META-INF/MANIFEST.MF
#	org.eclipse.jdt.core.tests.model/pom.xml
#	org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java
#	org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ResolveTests21.java
#	org.eclipse.jdt.core/.settings/.api_filters
#	org.eclipse.jdt.core/META-INF/MANIFEST.MF
#	org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StringTemplateComponent.java
#	org.eclipse.jdt.core/dom/org/eclipse/jdt/core/dom/StringTemplateExpression.java
#	org.eclipse.jdt.core/pom.xml
API filter and problem constant need version bump after merging with master.
Preparation
+ renamed the feature from "Statements before Super" to 
  "Flexible Constructor Bodies"
+ move the main flag, let ClassScope manage early construction contexts

Implement updates for JEP 482:
+ change wording towards "early construction context"
+ determine early-ctor-ctx based on target class
+ fine tuning:
  - where should enclosing types be considered?
  - search for enclosings first
    but also consider their supers in a second round
+ reduce # mechanisms for detecting early construction context
+ allow assignment to fields of uninitialized instance
+ differentiate new errors:
  - FieldReadInEarlyConstructionContext
  - ThisInEarlyConstructionContext
  - AllocationInEarlyConstructionContext
  - MessageSendInEarlyConstructionContext
  - DuplicateExplicitConstructorCall
  - ConstructorCallNotAllowedHere
  - SuperFieldAssignInEarlyConstructionContext
  - AssignFieldWithInitializerInEarlyConstructionContext
+ generation of synth args and fields for enclosing instances
  - such synthetics allow to skip over unavailable enclosing instances 
    towards outer instances that are available

Documentation of key strategies as javadoc / code comments:
+ enablement: JavaFeature.FLEXIBLE_CONSTRUCTOR_BODIES
  2-step strategy
  - does compliance generally allow the use of this feature?
    already at this level we may suggest to enable the feature
  - is the preview feature enabled?
+ detection / analysis: ClassScope.insideEarlyConstructionContext
  - describes the combination of structural and temporary contexts
+ explicit vs implicit constructor calls: CD.resolveStatements()
  - code comment describing updated contract of CD.constructorCall
+ code gen: TypeDeclaration.manageEnclosingInstanceAccessIfNecessary()
  - code comment describing the strategy to generate synth args & fields
    for various outer classes, which orchestrates code generation

Fixes #2472
…nts (#2731)

The changes especially include the scanner changes to recognize the
markdown format and resolve, validate and report tags and references
inside the markdown comments.

* Fix failing formatter tests by changing tests. Tests are failing due to markdown being
converted to Javadoc without a distinction from regular Javadoc. This
needs to be addressed in DOM.
#2743 (#2750)

Make sure that compliance level is set regardless of the AST level. Also, this being a standard feature, preview flag is not required.
Basic changes to CompletionScanner to recognize markdown comment blocks and associated tests
+ do expect ExplicitConstructorCall even in regular method

Fixes #2782
mpalat and others added 11 commits August 8, 2024 22:53
First cut changes for parsing markdown comments and create the TagElement and TextElement DOM nodes.
* JEP 455 - IOE - unboxing with widening primitive conversion

* additional tests
finetune parsing start of line by new companion IMarkdownCommentHelper
+ detect excess slashes after '///'
+ determine minimum amount of whitespace per markdown comment
+ preserve additional whitespace at beginning of line
+ detect code block from 4+ leading spaces
+ ensuree DocCommentParser and JavadocParser are in sync

Also:
+ avoid showing closing ']' of links
+ resolve one warning (redundant null check)
+ fix and extend compliance settings in RunCompletionParserTests
+ fix & extend test source in ../Converter_23/src/markdown/testBug228648
+ fix 1-off-bug in ASTConverterMarkdownTest.verifyPositions()
  + locally improve code structure (constant part outside the loop)

fixes #2808
* completing module names after "import module"
   - more relevance to modules that are read by the current module
* completing modifiers "module" / "static" after "import "

fixes #2823
+ codeblock cannot interrupt a paragraph
+ separate handling of code blocks indented vs fenced
  + fence does not terminate indented code block
  + handle various forms of fences:
     - ` vs. ~
     - different fence lengths
     - no mixed fences
     - fences inside fenced region
+ handle (and require) escaping of [ ] inside references (method arguments)

fixes #2824
…2836)

+ parser to record modifier start position of imports
+ avoid code duplication in SourceElementParser
+ new list ImportDeclaration.modifiers()
  + at 23 even 'static' is represented in that list
+ existing accessors may scan that list if present
+ adaptations in other parts of DOM implementation
+ consistently use Modifier even for static at JLS23
+ enable DOM testing at JLS23

fixes #2834
+ implement selection for module imports
+ includes new ResolveTests23
+ also add forgotten ResolveTests21 to the suite
  - but remove tests for withdrawn string template feature

fixes #2838
* Flush the JavaDocComment if it is attached with catch clause
*/
@Override
public void flushJavadocCommentsDefinedPriorTo() {
Copy link
Member

Choose a reason for hiding this comment

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

Why is it necessary to redefine this method rather than using the one already existing?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -4092,6 +4092,10 @@ protected void consumeExitTryBlock() {
if(this.currentElement != null) {
this.restartRecovery = true;
}
//Javadoc
if (this.scanner.commentStarts[0] > 0 && this.scanner.commentStops[0] > 0) {
Copy link
Member

Choose a reason for hiding this comment

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

I am not sure we want to do this here. It would better to be handled in the specific subclass Parser, like the CommentRecorderParser().

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Fix the replacement region

fixes #2823
+ several locations to generalize from isStatic to modifiers
+ remove bogus subarray() calls "extracting" the entire array

fixes #2852
test [] markdown link completion
ensure markdown links can be completed...
+ if ']' is still missing
+ on the last line of a comment
+ without any reference prefix

fixes #2744
@subyssurendran666 subyssurendran666 force-pushed the Incorrect-startPosition-of-a-SingleVariableDeclaration-in-the-catch-block-2564 branch 2 times, most recently from 0e4cbba to 94c6c36 Compare August 26, 2024 11:48
@jarthana
Copy link
Member

@subyssurendran666 The failures must be fixed before someone can review this PR.

EcljpseB0T and others added 4 commits August 27, 2024 14:15
#2766

Works around error in JDK which forgets to close Jar when
System.getSecurityManager()==null

As workaround trigger a GC to make a associated Cleaner Run for the
ZipFile no longer referenced.
…model.type.IntersectionType (#2702)

When a type variable has more than one super interfaces, we should create an intersection type with all the bounds.
@subyssurendran666 subyssurendran666 force-pushed the Incorrect-startPosition-of-a-SingleVariableDeclaration-in-the-catch-block-2564 branch from 94c6c36 to 6c9647c Compare August 27, 2024 08:45
@subyssurendran666 subyssurendran666 marked this pull request as draft August 27, 2024 12:34
Copy link
Contributor

@stephan-herrmann stephan-herrmann left a comment

Choose a reason for hiding this comment

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

Something is seriously out of sync here: the PR targets master, but it contains lots of changes from BETA_JAVA23.

@stephan-herrmann
Copy link
Contributor

Apparently an unintended merge happened, but due to force push it will be very hard to figure out what exactly happened and extract the intended changes from the pile.

@subyssurendran666
Copy link
Contributor Author

Apparently an unintended merge happened, but due to force push it will be very hard to figure out what exactly happened and extract the intended changes from the pile.

Stephan, instead of pulling from the master, I accidentally pulled from the BETA_JAVA23. So I have closed the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants