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

Consider supporting JEP 445 #209

Open
josephlewis42 opened this issue Jun 6, 2023 · 0 comments
Open

Consider supporting JEP 445 #209

josephlewis42 opened this issue Jun 6, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request P3

Comments

@josephlewis42
Copy link

JEP 445 (Preview in JDK 21) introduces unnamed classes and instance main methods. This could be a boon to writing functions if done right changing our result from this:

package com.example;

import com.google.cloud.functions.HttpFunction;
import com.google.cloud.functions.HttpRequest;
import com.google.cloud.functions.HttpResponse;

public class HelloWorld implements HttpFunction {
  @Override
  public void service(HttpRequest request, HttpResponse response)
      throws Exception {
    response.getWriter().write("Hello, World\n");
  }
}

To something like this:

import com.google.cloud.functions.FuncFramework;

void main() {
    FuncFramework.http((req, res) -> response.getWriter().write("Hello, World\n"));
}
@josephlewis42 josephlewis42 added enhancement New feature or request P3 labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request P3
Projects
None yet
Development

No branches or pull requests

2 participants