[
https://issues.apache.org/jira/browse/AVRO-3239?focusedWorklogId=691161&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-691161
]
ASF GitHub Bot logged work on AVRO-3239:
----------------------------------------
Author: ASF GitHub Bot
Created on: 06/Dec/21 16:15
Start Date: 06/Dec/21 16:15
Worklog Time Spent: 10m
Work Description: opwvhk commented on a change in pull request #1377:
URL: https://github.com/apache/avro/pull/1377#discussion_r763156934
##########
File path:
lang/java/compiler/src/main/java/org/apache/avro/compiler/idl/DocCommentHelper.java
##########
@@ -0,0 +1,155 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * Some portions of this file were modeled after the example Java 1.5
+ * parser included with JavaCC. The following license applies to those
+ * portions:
+ *
+ * Copyright (c) 2006, Sun Microsystems, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright notice,
+ * this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Sun Microsystems, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) 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 OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+package org.apache.avro.compiler.idl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+/**
+ * Utility class with {@code ThreadLocal} fields that allow the generated
+ * classes {@link Idl} and {@link IdlTokenManager} to exchange documentation
+ * comments without forcing explicit parsing of documentation comments.
+ *
+ * The reason this works is that all calls to this class happen within a call
to
+ * the method {@link Idl#CompilationUnit()} (either directly or indirectly).
Review comment:
This is the reason for having static `ThreadLocal` fields only. It's the
same reason as why the the `Idl` class defined by `idl.jj` also contained a
`ThreadLocal` field.
The main difference is that all this magic has been put in a single class.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 691161)
Time Spent: 1h 10m (was: 1h)
> IDL parsing silently ignores dangling documentation comments
> ------------------------------------------------------------
>
> Key: AVRO-3239
> URL: https://issues.apache.org/jira/browse/AVRO-3239
> Project: Apache Avro
> Issue Type: Improvement
> Components: java, spec, tools
> Affects Versions: 1.8.2, 1.9.2, 1.10.2
> Reporter: Oscar Westra van Holthe - Kind
> Priority: Minor
> Labels: pull-request-available
> Fix For: 1.11.1
>
> Attachments: comments.avdl, comments.avpr
>
> Time Spent: 1h 10m
> Remaining Estimate: 0h
>
> When parsing IDL, only the last documentation comment for a declaration is
> used.
> Any previous documentation comments are silently ignored.
> Proposed fix: while keeping the exact same parsing results, emit warnings for
> each documentation comment that is ignored.
> Additional suggestion: mention that a common cause for such a warning is
> using a documentation comment instead of a multiline comment.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)