Skip to content

Commit

Permalink
Update docs & licenses to use https (#1118)
Browse files Browse the repository at this point in the history
* Replace all http with https in apache licenses

* Replace all http with https in oracle docs
  • Loading branch information
Goooler authored Aug 11, 2021
1 parent c0d8d75 commit 7c6f4db
Show file tree
Hide file tree
Showing 82 changed files with 121 additions and 121 deletions.
4 changes: 2 additions & 2 deletions LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
https://www.apache.org/licenses/

TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION

Expand Down Expand Up @@ -193,7 +193,7 @@
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
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,
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ License
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
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,
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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,
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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,
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/Dependencies.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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,
Expand Down
68 changes: 34 additions & 34 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ properties (`PropertySpec`), functions & constructors (`FunSpec`), parameters (`
annotations (`AnnotationSpec`).

But the _body_ of methods and constructors is not modeled. There's no expression class, no
statement class or syntax tree nodes. Instead, KotlinPoet uses strings for code blocks, and you can
statement class or syntax tree nodes. Instead, KotlinPoet uses strings for code blocks, and you can
take advantage of Kotlin's multiline strings to make this look nice:

```kotlin
Expand Down Expand Up @@ -140,11 +140,11 @@ fun main(args: Array<String>) {
.addFunction(whatsMyNameYo("eminem"))
.addFunction(whatsMyNameYo("marshallMathers"))
.build()

val kotlinFile = FileSpec.builder("com.example.helloworld", "HelloWorld")
.addType(helloWorld)
.build()

kotlinFile.writeTo(System.out)
}

Expand All @@ -170,7 +170,7 @@ class HelloWorld {

### %P for String Templates

`%S` also handles the escaping of dollar signs (`$`), to avoid inadvertent creation of string
`%S` also handles the escaping of dollar signs (`$`), to avoid inadvertent creation of string
templates, which may fail to compile in generated code:

```kotlin
Expand Down Expand Up @@ -294,7 +294,7 @@ class HelloWorld {

The `ClassName` type is very important, and you'll need it frequently when you're using KotlinPoet.
It can identify any _declared_ class. Declared types are just the beginning of Kotlin's rich type
system: we also have arrays, parameterized types, wildcard types, lambda types and type variables.
system: we also have arrays, parameterized types, wildcard types, lambda types and type variables.
KotlinPoet has classes for building each of these:

```kotlin
Expand Down Expand Up @@ -353,7 +353,7 @@ class HelloWorld {

#### Nullable Types

KotlinPoet supports nullable types. To convert a `TypeName` into its nullable counterpart, use the
KotlinPoet supports nullable types. To convert a `TypeName` into its nullable counterpart, use the
`copy()` method with `nullable` parameter set to `true`:

```kotlin
Expand Down Expand Up @@ -412,10 +412,10 @@ fun main() {
}
```

As you can see, it's also possible to use `%M` to reference extension functions and properties. You
just need to make sure the member can be imported without simple name collisions, otherwise
importing will fail and the code generator output will not pass compilation. There's a way to work
around such cases though - use `FileSpec.addAliasedImport()` to create an alias for a clashing
As you can see, it's also possible to use `%M` to reference extension functions and properties. You
just need to make sure the member can be imported without simple name collisions, otherwise
importing will fail and the code generator output will not pass compilation. There's a way to work
around such cases though - use `FileSpec.addAliasedImport()` to create an alias for a clashing
`MemberName`:

```kotlin
Expand All @@ -434,7 +434,7 @@ val file = FileSpec.builder("com.squareup.example", "Test")
.build())
.build()
println(file)
```
```

KotlinPoet will produce an aliased import for `com.squareup.tacos2.isVegan`:

Expand Down Expand Up @@ -533,7 +533,7 @@ val byteToHex = FunSpec.builder("byteToHex")
.build()
```

Another handy feature that `%N` provides is automatically escaping names that contain illegal
Another handy feature that `%N` provides is automatically escaping names that contain illegal
identifier characters with double ticks. Suppose your code creates a `MemberName` with a Kotlin
keyword as the simple name:

Expand Down Expand Up @@ -565,7 +565,7 @@ fun packageTacos(tacos: List<Taco>, packager: TacoPackager) {

### %L for Literals

Although Kotlin's string templates usually work well in cases when you want to include literals into
Although Kotlin's string templates usually work well in cases when you want to include literals into
generated code, KotlinPoet offers additional syntax inspired-by but incompatible-with
[`String.format()`][formatter]. It accepts **`%L`** to emit a **literal** value in the output. This
works just like `Formatter`'s `%s`:
Expand Down Expand Up @@ -621,7 +621,7 @@ map += "food" to "tacos"
map += "count" to 3
CodeBlock.builder().addNamed("I ate %count:L %food:L", map)
```

### Functions

All of the above functions have a code body. Use `KModifier.ABSTRACT` to get a function without any
Expand Down Expand Up @@ -718,7 +718,7 @@ FunSpec.builder("add")
#### Spaces wrap by default!

In order to provide meaningful formatting, KotlinPoet would replace spaces, found in blocks of code,
with new line symbols, in cases when the line of code exceeds the length limit. Let's take this
with new line symbols, in cases when the line of code exceeds the length limit. Let's take this
function for example:

```kotlin
Expand All @@ -730,13 +730,13 @@ val funSpec = FunSpec.builder("foo")
Depending on where it's found in the file, it may end up being printed out like this:

```kotlin
fun foo() = (100..10000).map { number -> number * number }.map { number -> number.toString() }.also
fun foo() = (100..10000).map { number -> number * number }.map { number -> number.toString() }.also
{ string -> println(string) }
```

Unfortunately this code is broken: the compiler expects `also` and `{` to be on the same line.
KotlinPoet is unable to understand the context of the expression and fix the formatting for you, but
there's a trick you can use to declare a non-breaking space - use the `·` symbol where you would
Unfortunately this code is broken: the compiler expects `also` and `{` to be on the same line.
KotlinPoet is unable to understand the context of the expression and fix the formatting for you, but
there's a trick you can use to declare a non-breaking space - use the `·` symbol where you would
otherwise use a space. Let's apply this to our example:

```kotlin
Expand Down Expand Up @@ -793,7 +793,7 @@ val helloWorld = TypeSpec.classBuilder("HelloWorld")
.primaryConstructor(flux)
.addProperty("greeting", String::class, KModifier.PRIVATE)
.build()
```
```

This code, however, generates the following:

Expand All @@ -807,7 +807,7 @@ class HelloWorld(greeting: String) {
```

By default, KotlinPoet won't merge primary constructor parameters and properties, even if they share
the same name. To achieve the effect, you have to tell KotlinPoet that the property is initialized
the same name. To achieve the effect, you have to tell KotlinPoet that the property is initialized
via the constructor parameter:

```kotlin
Expand Down Expand Up @@ -923,7 +923,7 @@ val android = PropertySpec.builder("android", String::class)
will produce an error:

```
java.lang.IllegalArgumentException: KotlinPoet doesn't allow setting the inline modifier on
java.lang.IllegalArgumentException: KotlinPoet doesn't allow setting the inline modifier on
properties. You should mark either the getter, the setter, or both inline.
```

Expand All @@ -946,7 +946,7 @@ val android: kotlin.String
inline get() = "foo"
```

Now, what if we wanted to add a non-inline setter to the property above? We can do so without
Now, what if we wanted to add a non-inline setter to the property above? We can do so without
modifying any of the code we wrote previously:

```kotlin
Expand Down Expand Up @@ -980,16 +980,16 @@ inline val android: kotlin.String
}
```

Removing the modifier from either the getter or the setter will unwrap the expression back.
Removing the modifier from either the getter or the setter will unwrap the expression back.

If, on the other hand, KotlinPoet had allowed marking a property `inline` directly, the programmer
would have had to manually add/remove the modifier whenever the state of the accessors changes in
order to get correct and compilable output. We're solving this problem by making accessors the
source of truth for the `inline` modifier.
If, on the other hand, KotlinPoet had allowed marking a property `inline` directly, the programmer
would have had to manually add/remove the modifier whenever the state of the accessors changes in
order to get correct and compilable output. We're solving this problem by making accessors the
source of truth for the `inline` modifier.

### Interfaces

KotlinPoet has no trouble with interfaces. Note that interface methods must always be `ABSTRACT`.
KotlinPoet has no trouble with interfaces. Note that interface methods must always be `ABSTRACT`.
The modifier is necessary when defining the interface:

```kotlin
Expand All @@ -1012,7 +1012,7 @@ interface HelloWorld {
}
```

Kotlin 1.4 adds support for functional interfaces via `fun interface` syntax. To create this in
Kotlin 1.4 adds support for functional interfaces via `fun interface` syntax. To create this in
KotlinPoet, use `TypeSpec.funInterfaceBuilder()`.

```kotlin
Expand Down Expand Up @@ -1043,7 +1043,7 @@ val helloWorld = TypeSpec.objectBuilder("HelloWorld")
.build()
```

Similarly, you can create companion objects and add them to classes using `addType()`:
Similarly, you can create companion objects and add them to classes using `addType()`:

```kotlin
val companion = TypeSpec.companionObjectBuilder()
Expand Down Expand Up @@ -1130,7 +1130,7 @@ enum class Roshambo(private val handsign: String) {

### Anonymous Inner Classes

In the enum code, we used `TypeSpec.anonymousClassBuilder()`. Anonymous inner classes can also be
In the enum code, we used `TypeSpec.anonymousClassBuilder()`. Anonymous inner classes can also be
used in code blocks. They are values that can be referenced with `%L`:

```kotlin
Expand Down Expand Up @@ -1166,7 +1166,7 @@ class HelloWorld {
```

One particularly tricky part of defining anonymous inner classes is the arguments to the superclass
constructor. To pass them use `TypeSpec.Builder`'s `addSuperclassConstructorParameter()` method.
constructor. To pass them use `TypeSpec.Builder`'s `addSuperclassConstructorParameter()` method.

### Annotations

Expand Down Expand Up @@ -1392,7 +1392,7 @@ License
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0
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,
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ POM_SCM_CONNECTION=scm:git:https://github.com/square/kotlinpoet.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://[email protected]/square/kotlinpoet.git

POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo

POM_DEVELOPER_ID=square
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import javax.lang.model.util.Types
*/

/**
* For reference, see the [JVM specification, section 4.2](http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.2).
* For reference, see the [JVM specification, section 4.2](https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.2).
*
* @return the name of this [Element] in its "internal form".
*/
Expand Down Expand Up @@ -132,7 +132,7 @@ internal fun ExecutableType.descriptor(types: Types): String {
*
* Useful for comparing with [JvmMethodSignature].
*
* For reference, see the [JVM specification, section 4.3](http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3).
* For reference, see the [JVM specification, section 4.3](https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3).
*/
internal fun ExecutableElement.jvmMethodSignature(types: Types): String {
return "$simpleName${asType().descriptor(types)}"
Expand All @@ -143,7 +143,7 @@ internal fun ExecutableElement.jvmMethodSignature(types: Types): String {
*
* Useful for comparing with [JvmFieldSignature].
*
* For reference, see the [JVM specification, section 4.3](http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3).
* For reference, see the [JVM specification, section 4.3](https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3).
*/
internal fun VariableElement.jvmFieldSignature(types: Types): String {
return "$simpleName:${asType().descriptor(types)}"
Expand All @@ -154,7 +154,7 @@ internal fun VariableElement.jvmFieldSignature(types: Types): String {
* - a "field descriptor", for example: `Ljava/lang/Object;`
* - a "method descriptor", for example: `(Ljava/lang/Object;)Z`
*
* For reference, see the [JVM specification, section 4.3](http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3).
* For reference, see the [JVM specification, section 4.3](https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3).
*/
internal object JvmDescriptorTypeVisitor : AbstractTypeVisitor6<String, Types>() {
override fun visitNoType(t: NoType, types: Types): String = t.descriptor
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ public class ReflectiveClassInspector private constructor(
*
* Useful for comparing with [JvmMethodSignature].
*
* For reference, see the [JVM specification, section 4.3](http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3).
* For reference, see the [JVM specification, section 4.3](https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3).
*/
private val Method.jvmMethodSignature: String get() = "$name$descriptor"

Expand All @@ -564,7 +564,7 @@ public class ReflectiveClassInspector private constructor(
*
* Useful for comparing with [JvmMethodSignature].
*
* For reference, see the [JVM specification, section 4.3](http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3).
* For reference, see the [JVM specification, section 4.3](https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3).
*/
private val Constructor<*>.jvmMethodSignature: String get() = "<init>$descriptor"

Expand All @@ -573,7 +573,7 @@ public class ReflectiveClassInspector private constructor(
*
* Useful for comparing with [JvmFieldSignature].
*
* For reference, see the [JVM specification, section 4.3](http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3).
* For reference, see the [JVM specification, section 4.3](https://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.3).
*/
private val Field.jvmFieldSignature: String get() = "$name:${type.descriptor}"
}
Expand Down
2 changes: 1 addition & 1 deletion interop/kotlinx-metadata/core/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* 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,
Expand Down
Loading

0 comments on commit 7c6f4db

Please sign in to comment.