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

LDEV-2646 ignore java docs comments inside a function #2406

Open
wants to merge 1 commit into
base: 6.2
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2048,7 +2048,7 @@ private boolean multiLineComment(Data data) throws TemplateException {
cfml.setPos(pos);
throw new TemplateException(cfml, "comment is not closed");
}
if (isDocComment) {
if (isDocComment && !data.insideFunction) {
String comment = cfml.substring(pos - 2, cfml.getPos() - pos);
data.docComment = docCommentTransformer.transform(data.factory, comment);
}
Expand Down
30 changes: 14 additions & 16 deletions test/tickets/LDEV2646.cfc
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
component extends = "org.lucee.cfml.test.LuceeTestCase" labels="syntax" skip=true {
component extends = "org.lucee.cfml.test.LuceeTestCase" labels="syntax" {
function beforeAll(){
variables.uri = createURI("LDEV2646");
pagePoolClear();
}

function run( testResults, testBox ){
describe( "Test case for LDEV2646", function(){
it( title = "checking lock with comment line" , body = function( currentSpec ){
local.result = _InternalRequest(
template : "#uri#\test.cfm",
form : { scene = 1}
);
expect(trim(result.filecontent)).toBe(true);
var obj = createobject( "component", "LDEV2646.obj" );
debug(obj);
expect( obj.testBadDocComment() ).toBeTrue();

});

it( title = "checking lock without comment line" , body = function( currentSpec ){
local.result = _InternalRequest(
template : "#uri#\test.cfm",
form : { scene = 2 }
);
expect(trim(result.filecontent)).toBe(true);
var obj = createobject( "component", "LDEV2646.obj" );
debug(obj.testGoodDocComment);
expect( obj.testGoodDocComment() ).toBeTrue();
});

it( title = "checking lock no comment line" , body = function( currentSpec ){
var obj = createobject( "component", "LDEV2646.obj" );
expect( obj.testNoDocComment() ).toBeTrue();
});
});
}

private string function createURI(string calledName){
var baseURI = "/test/#listLast(getDirectoryFromPath(getCurrenttemplatepath()),"\/")#/";
return baseURI&""&calledName;
}
}
25 changes: 25 additions & 0 deletions test/tickets/LDEV2646/ldev2646_doc_comments.cfc
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* I'm a test component
* @hint doc comments inside a function should be ignored!
*/
component name='testComponent' {
function testBadDocComment() {
/** If you delete this comment, all will be well! */
lock name='test' timeout=1 type="exclusive" {
return true;
}
}

function testGoodDocComment() {
/* I'm ok, as i'm on the second line */
timer {
return true;
}
}

function testNoDocComment() {
lock name='test' timeout=1 type="exclusive" {
return true;
}
}
}
14 changes: 0 additions & 14 deletions test/tickets/LDEV2646/obj.cfc

This file was deleted.

13 changes: 0 additions & 13 deletions test/tickets/LDEV2646/test.cfm

This file was deleted.

Loading