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

Correctly escape comments that may contain tags #1426

Merged
merged 6 commits into from
Aug 14, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 4 additions & 0 deletions pkgs/jnigen/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.10.1

- Add backticks to code references in doc comments.

## 0.10.0

- Added support for Kotlin's top-level functions and fields.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/jnigen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class AndroidUtils extends jni.JObject {
jni.JThrowablePtr Function(ffi.Pointer<ffi.Void>, jni.JMethodIDPtr,
ffi.Pointer<ffi.Void>, ffi.Pointer<ffi.Void>, int)>();

/// from: static public void showToast(android.app.Activity mainActivity, java.lang.CharSequence text, int duration)
/// from: `static public void showToast(android.app.Activity mainActivity, java.lang.CharSequence text, int duration)`
static void showToast(
jni.JObject mainActivity,
jni.JObject text,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import 'package:jni/jni.dart' as jni;

import 'PDDocumentInformation.dart' as pddocumentinformation_;

/// from: org.apache.pdfbox.pdmodel.PDDocument
/// from: `org.apache.pdfbox.pdmodel.PDDocument`
///
/// This is the in-memory representation of the PDF document.
/// The \#close() method must be called once the document is no longer needed.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import 'dart:isolate' show ReceivePort;
import 'package:jni/internal_helpers_for_jnigen.dart';
import 'package:jni/jni.dart' as jni;

/// from: org.apache.pdfbox.pdmodel.PDDocumentInformation
/// from: `org.apache.pdfbox.pdmodel.PDDocumentInformation`
///
/// This is the document metadata. Each getXXX method will return the entry if
/// it exists or null if it does not exist. If you pass in null for the setXXX
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import 'package:jni/jni.dart' as jni;

import '../pdmodel/PDDocument.dart' as pddocument_;

/// from: org.apache.pdfbox.text.PDFTextStripper
/// from: `org.apache.pdfbox.text.PDFTextStripper`
///
/// This class will take a pdf document and strip out all of the text and ignore the formatting and such. Please note; it
/// is up to clients of this class to verify that a specific user has the correct permissions to extract text from the
Expand All @@ -75,7 +75,7 @@ class PDFTextStripper extends jni.JObject {
r'Ljava/lang/String;',
);

/// from: protected final java.lang.String LINE_SEPARATOR
/// from: `protected final java.lang.String LINE_SEPARATOR`
/// The returned object must be released after use, by calling the [release] method.
///
/// The platform's line separator.
Expand All @@ -87,7 +87,7 @@ class PDFTextStripper extends jni.JObject {
r'Ljava/util/ArrayList;',
);

/// from: protected java.util.ArrayList<java.util.List<org.apache.pdfbox.text.TextPosition>> charactersByArticle
/// from: `protected java.util.ArrayList<java.util.List<org.apache.pdfbox.text.TextPosition>> charactersByArticle`
/// The returned object must be released after use, by calling the [release] method.
///
/// The charactersByArticle is used to extract text by article divisions. For example a PDF that has two columns like
Expand All @@ -105,7 +105,7 @@ class PDFTextStripper extends jni.JObject {
jni.JObject get charactersByArticle =>
_id_charactersByArticle.get(this, const jni.JObjectType());

/// from: protected java.util.ArrayList<java.util.List<org.apache.pdfbox.text.TextPosition>> charactersByArticle
/// from: `protected java.util.ArrayList<java.util.List<org.apache.pdfbox.text.TextPosition>> charactersByArticle`
/// The returned object must be released after use, by calling the [release] method.
///
/// The charactersByArticle is used to extract text by article divisions. For example a PDF that has two columns like
Expand All @@ -128,12 +128,12 @@ class PDFTextStripper extends jni.JObject {
r'Lorg/apache/pdfbox/pdmodel/PDDocument;',
);

/// from: protected org.apache.pdfbox.pdmodel.PDDocument document
/// from: `protected org.apache.pdfbox.pdmodel.PDDocument document`
/// The returned object must be released after use, by calling the [release] method.
pddocument_.PDDocument get document =>
_id_document.get(this, const pddocument_.$PDDocumentType());

/// from: protected org.apache.pdfbox.pdmodel.PDDocument document
/// from: `protected org.apache.pdfbox.pdmodel.PDDocument document`
/// The returned object must be released after use, by calling the [release] method.
set document(pddocument_.PDDocument value) =>
_id_document.set(this, const pddocument_.$PDDocumentType(), value);
Expand All @@ -143,11 +143,11 @@ class PDFTextStripper extends jni.JObject {
r'Ljava/io/Writer;',
);

/// from: protected java.io.Writer output
/// from: `protected java.io.Writer output`
/// The returned object must be released after use, by calling the [release] method.
jni.JObject get output => _id_output.get(this, const jni.JObjectType());

/// from: protected java.io.Writer output
/// from: `protected java.io.Writer output`
/// The returned object must be released after use, by calling the [release] method.
set output(jni.JObject value) =>
_id_output.set(this, const jni.JObjectType(), value);
Expand Down
4 changes: 2 additions & 2 deletions pkgs/jnigen/lib/src/bindings/dart_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ ${modifier}final $classRef = $_jni.JClass.forName(r'$internalName');
return;
}
// Docs.
s.write('/// from: ${node.binaryName}\n');
s.write('/// from: `${node.binaryName}`\n');
node.javadoc?.accept(_DocGenerator(s, depth: 0));

// Class definition.
Expand Down Expand Up @@ -956,7 +956,7 @@ ${modifier}final _id_$name =

void writeDocs(Field node, {required bool writeReleaseInstructions}) {
final originalDecl = '${node.type.shorthand} ${node.name}';
s.writeln(' /// from: ${node.modifiers.join(' ')} $originalDecl');
s.writeln(' /// from: `${node.modifiers.join(' ')} $originalDecl`');
if (node.type.kind != Kind.primitive && writeReleaseInstructions) {
s.writeln(_releaseInstruction);
}
Expand Down
2 changes: 1 addition & 1 deletion pkgs/jnigen/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

name: jnigen
description: A Dart bindings generator for Java and Kotlin that uses JNI under the hood to interop with Java virtual machine.
version: 0.10.0
version: 0.10.1
repository: https://github.com/dart-lang/native/tree/main/pkgs/jnigen

environment:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import 'package:jni/jni.dart' as jni;

import 'JsonParser.dart' as jsonparser_;

/// from: com.fasterxml.jackson.core.JsonFactory$Feature
/// from: `com.fasterxml.jackson.core.JsonFactory$Feature`
///
/// Enumeration that defines all on/off features that can only be
/// changed for JsonFactory.
Expand Down Expand Up @@ -237,7 +237,7 @@ final class $JsonFactory_FeatureType extends jni.JObjType<JsonFactory_Feature> {
}
}

/// from: com.fasterxml.jackson.core.JsonFactory
/// from: `com.fasterxml.jackson.core.JsonFactory`
///
/// The main factory class of Jackson package, used to configure and
/// construct reader (aka parser, JsonParser)
Expand Down Expand Up @@ -274,7 +274,7 @@ class JsonFactory extends jni.JObject {
r'Ljava/lang/String;',
);

/// from: static public final java.lang.String FORMAT_NAME_JSON
/// from: `static public final java.lang.String FORMAT_NAME_JSON`
/// The returned object must be released after use, by calling the [release] method.
///
/// Name used to identify JSON format
Expand All @@ -287,7 +287,7 @@ class JsonFactory extends jni.JObject {
r'I',
);

/// from: static protected final int DEFAULT_FACTORY_FEATURE_FLAGS
/// from: `static protected final int DEFAULT_FACTORY_FEATURE_FLAGS`
///
/// Bitfield (set of flags) of all factory features that are enabled by default.
static int get DEFAULT_FACTORY_FEATURE_FLAGS =>
Expand All @@ -298,7 +298,7 @@ class JsonFactory extends jni.JObject {
r'I',
);

/// from: static protected final int DEFAULT_PARSER_FEATURE_FLAGS
/// from: `static protected final int DEFAULT_PARSER_FEATURE_FLAGS`
///
/// Bitfield (set of flags) of all parser features that are enabled
/// by default.
Expand All @@ -310,7 +310,7 @@ class JsonFactory extends jni.JObject {
r'I',
);

/// from: static protected final int DEFAULT_GENERATOR_FEATURE_FLAGS
/// from: `static protected final int DEFAULT_GENERATOR_FEATURE_FLAGS`
///
/// Bitfield (set of flags) of all generator features that are enabled
/// by default.
Expand All @@ -322,7 +322,7 @@ class JsonFactory extends jni.JObject {
r'Lcom/fasterxml/jackson/core/SerializableString;',
);

/// from: static public final com.fasterxml.jackson.core.SerializableString DEFAULT_ROOT_VALUE_SEPARATOR
/// from: `static public final com.fasterxml.jackson.core.SerializableString DEFAULT_ROOT_VALUE_SEPARATOR`
/// The returned object must be released after use, by calling the [release] method.
static jni.JObject get DEFAULT_ROOT_VALUE_SEPARATOR =>
_id_DEFAULT_ROOT_VALUE_SEPARATOR.get(_class, const jni.JObjectType());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import 'package:jni/jni.dart' as jni;

import 'JsonToken.dart' as jsontoken_;

/// from: com.fasterxml.jackson.core.JsonParser$Feature
/// from: `com.fasterxml.jackson.core.JsonParser$Feature`
///
/// Enumeration that defines all on/off features for parsers.
class JsonParser_Feature extends jni.JObject {
Expand Down Expand Up @@ -236,7 +236,7 @@ final class $JsonParser_FeatureType extends jni.JObjType<JsonParser_Feature> {
}
}

/// from: com.fasterxml.jackson.core.JsonParser$NumberType
/// from: `com.fasterxml.jackson.core.JsonParser$NumberType`
///
/// Enumeration of possible "native" (optimal) types that can be
/// used for numbers.
Expand Down Expand Up @@ -331,7 +331,7 @@ final class $JsonParser_NumberTypeType
}
}

/// from: com.fasterxml.jackson.core.JsonParser
/// from: `com.fasterxml.jackson.core.JsonParser`
///
/// Base class that defines public API for reading JSON content.
/// Instances are created using factory methods of
Expand All @@ -355,7 +355,7 @@ class JsonParser extends jni.JObject {
r'Lcom/fasterxml/jackson/core/util/JacksonFeatureSet;',
);

/// from: static protected final com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamReadCapability> DEFAULT_READ_CAPABILITIES
/// from: `static protected final com.fasterxml.jackson.core.util.JacksonFeatureSet<com.fasterxml.jackson.core.StreamReadCapability> DEFAULT_READ_CAPABILITIES`
/// The returned object must be released after use, by calling the [release] method.
///
/// Default set of StreamReadCapabilityies that may be used as
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import 'dart:isolate' show ReceivePort;
import 'package:jni/internal_helpers_for_jnigen.dart';
import 'package:jni/jni.dart' as jni;

/// from: com.fasterxml.jackson.core.JsonToken
/// from: `com.fasterxml.jackson.core.JsonToken`
///
/// Enumeration for basic token types used for returning results
/// of parsing JSON content.
Expand Down
2 changes: 1 addition & 1 deletion pkgs/jnigen/test/kotlin_test/bindings/kotlin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import 'dart:isolate' show ReceivePort;
import 'package:jni/internal_helpers_for_jnigen.dart';
import 'package:jni/jni.dart' as jni;

/// from: com.github.dart_lang.jnigen.SuspendFun
/// from: `com.github.dart_lang.jnigen.SuspendFun`
class SuspendFun extends jni.JObject {
@override
late final jni.JObjType<SuspendFun> $type = type;
Expand Down
Loading
Loading